Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code breakpoints jump to other lines

Tags:

As I haven't solved my other issue yet Randomly failing tests jest and supertest Node.js I've decided to use the VS Code debugger. I thought that it would be pretty simple but after I've set a breakpoint at the certain line and run the debugger I find my breakpoint icon in a different place and my code stops there.

My launch.json file:

{     "type": "node",     "request": "launch",     "name": "Jest Current File",     "program": "${workspaceFolder}/node_modules/jest/bin/jest",     "args": ["${relativeFile}"] } 

Before: enter image description here

After: enter image description here

Any idea why this happens?

like image 951
lekterable Avatar asked Apr 22 '18 10:04

lekterable


People also ask

How do you jump to a breakpoint in Vscode?

Run to a breakpoint in code To set a simple breakpoint in your code, select the far-left margin next to the line of code where you want to suspend execution. You can also select the line and then select F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert Breakpoint.

How do I jump from one breakpoint to another in Visual Studio?

Jump to a breakpointPress Ctrl+Alt+F9 or choose ReSharper | Navigate | Breakpoints… from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.

How do I skip a line while debugging in Visual Studio?

You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.

What is inline breakpoint in Vscode?

Inline breakpoints# This is particularly useful when debugging minified code which contains multiple statements in a single line. An inline breakpoint can be set using Shift+F9 or through the context menu during a debug session. Inline breakpoints are shown inline in the editor.


1 Answers

Generally in some IDEs, the breakpoints are fixed to the line number. So if code in that file changes after the breakpoint is set, the breakpoint doesn't move. So when making changes,

  • stop the debug mode
  • make the changes
  • set the breakpoint
  • start debug mode again. This worked for me.
like image 159
MidKar Avatar answered Dec 19 '22 01:12

MidKar