在Visual Studio代码中添加断点

时间:2016-08-12 17:21:16

标签: visual-studio-code

我必须做一些愚蠢的错误,因为我似乎无法在Visual Studio Code中添加断点。

当我右键单击我的代码时会弹出以下内容。 (左侧点击行号旁边也不起作用)

enter image description here

我在这里阅读了文档https://code.visualstudio.com/docs/editor/debugging#_breakpoints

它声明:

  

可以通过单击编辑器边距来切换断点。

我不知道它是什么或我在哪里找到它。至少可以说缺少初学者的文档。

5 个答案:

答案 0 :(得分:10)

转到VS->Settings->Debug并将“debug.allowBreakpointsEverywhere”更改为true。

答案 1 :(得分:8)

截至 2020年12月

的最新答案

对于那些难以找到debug.allowBreakpointsEverywhere的人。

文件->首选项->设置

然后搜索“ debug.allowBreakpointsEverywhere”。单击复选框,它将自动保存。干杯!

enter image description here

答案 2 :(得分:6)

编辑边距留给行号。

左键单击应在所需的行上设置断点。

答案 3 :(得分:5)

我也遇到过这个问题。确保你没有

"editor.glyphMargin": false,

在您的用户或工作区设置中。

答案 4 :(得分:3)

Ok Visual Studio Code是错误的。

我无法在行号旁边点击,但是当我去调试视图并开始玩下面看到的所有框时,它开始工作了,它必须激活一些东西:

enter image description here