CN
CodeNest Docs
Features

Debugging

Master CodeNest's powerful debugging tools to identify and fix issues in your code efficiently.

Getting Started with Debugging

CodeNest provides a comprehensive debugging experience with breakpoints, variable inspection, call stack analysis, and step-through debugging for multiple languages.

Setting Up Debug Configuration

  1. Open your project in CodeNest
  2. Go to Run and Debug view (Ctrl+Shift+D)
  3. Click "create a launch.json file"
  4. Select your environment (Node.js, Python, etc.)

Breakpoints

Setting Breakpoints

  • Click in the gutter next to line numbers
  • Use F9 to toggle breakpoints
  • Right-click for conditional breakpoints

Types of Breakpoints

  • Line Breakpoints - Stop at specific lines
  • Conditional Breakpoints - Stop when condition is true
  • Hit Count Breakpoints - Stop after N hits
  • Function Breakpoints - Stop when function is called

Debug Controls

Execution Controls

ActionShortcutDescription
ContinueF5Resume execution
Step OverF10Execute next line
Step IntoF11Step into function calls
Step OutShift+F11Step out of current function
RestartCtrl+Shift+F5Restart debugging session
StopShift+F5Stop debugging

Variable Inspection

Variables Panel

The Variables panel shows:

  • Local variables in current scope
  • Global variables
  • Closure variables
  • Object properties and array elements

Watch Expressions

Monitor specific expressions:

  1. Open the Watch panel
  2. Click the "+" button
  3. Enter the expression to watch
  4. Values update as you debug

Call Stack

The Call Stack panel shows:

  • Current execution path
  • Function call hierarchy
  • Click frames to navigate
  • View local variables for each frame

Debug Console

Use the Debug Console to:

  • Evaluate expressions in current context
  • Execute commands during debugging
  • View debug output and logs
  • Interact with your application

Language-Specific Debugging

JavaScript/Node.js

{
  "type": "node",
  "request": "launch",
  "name": "Launch Program",
  "program": "${workspaceFolder}/app.js",
  "console": "integratedTerminal"
}

Python

{
  "type": "python",
  "request": "launch",
  "name": "Python: Current File",
  "program": "${file}",
  "console": "integratedTerminal"
}

Java

{
  "type": "java",
  "request": "launch",
  "name": "Launch Java Program",
  "mainClass": "Main",
  "classPaths": ["${workspaceFolder}"]
}

Remote Debugging

Attach to Process

  1. Start your application with debug flags
  2. Create attach configuration in launch.json
  3. Use "Attach to Process" from debug menu
  4. Select the target process

Remote Server Debugging

{
  "type": "node",
  "request": "attach",
  "name": "Attach to Remote",
  "address": "localhost",
  "port": 9229
}

Advanced Features

Multi-target Debugging

Debug multiple processes simultaneously:

  • Configure multiple launch configurations
  • Use compound configurations
  • Switch between debug sessions

Exception Handling

Configure exception breakpoints:

  • Break on all exceptions
  • Break on uncaught exceptions only
  • Filter by exception type

Debugging Tips

Best Practices

  • Use meaningful variable names for easier inspection
  • Set conditional breakpoints to avoid noise
  • Use the debug console for quick tests
  • Leverage watch expressions for complex conditions

Performance Debugging

  • Use profiling tools for performance issues
  • Monitor memory usage in variables panel
  • Check call stack for performance bottlenecks

Troubleshooting

Common Issues

  • Breakpoints not hit - Check source maps and file paths
  • Variables not showing - Ensure debug symbols are available
  • Slow debugging - Reduce number of watch expressions

Debug Configuration Problems

  • Verify launch.json syntax
  • Check file paths and working directory
  • Ensure required extensions are installed