vscode开发调试js、python,vscodepython
vscode开发调试js、python,vscodepython
1.调试js
安装Debuger for chrome插件,点击F5,选择chrome,vscode自动生成lauch.json如下,
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "启动 Chrome 并打开 localhost",
"url": "${file}",//修改这里,每次调试当前文件
"webRoot": "${workspaceFolder}"
}
]
}
"${file}",//修改这里,每次调试当前文件
"webRoot": "${workspaceFolder}"
}
]
}
chrome attach调试,chrome端使用--remote-debugging-port=9222方式启动,然后配置lauch.json的request为attach
js动态加载的文件,vscode断点无效(未验证的断点----可以用debuger下断点):
在要被调用的文件开始处,加//@ sourceURL=ParcelProcessWaitForArchivedListPage.js,加上注释后打开chrome调试,vscode可以捕获chrome断点,断点需要设置到chrome里面,vscode调试。如果//@ sourceURL=文件的本地绝对路径,就可以在vscode上直接调试了,而且断点有效。提示://@ sourceURL中间要有空格
参考:https://blog.csdn.net/ebay/article/details/45894543
2.配置setting.json调试python
设置pythonpath和pylintpath路径,如果要使用anaconda,配置python目录为的env目录下的python.exe即可
3.lauch.json预定义变量
${workspaceRoot} - the path of the folder opened in VS Code
${workspaceRootFolderName} - the name of the folder opened in VS Code without any slashes (/)
${file} - the current opened file
${relativeFile} - the current opened file relative to workspaceRoot
${fileBasename} - the current opened file's basename
${fileBasenameNoExtension} - the current opened file's basename with no file extension
${fileDirname} - the current opened file's dirname
${fileExtname} - the current opened file's extension
${cwd} - the task runner's current working directory on startup
${lineNumber} - the current selected line number in the active file
lauch文件中的可配置多个调试json项,key值“”中自动提示,配置完后在vscode的调试选项中可以看到多项调试选项
4.task.json配置编译过程
task定义的命令可以被lauch.json调用,ctrl+shift+b运行任务
5.vscode调试器扩展
参考:https://code.visualstudio.com/docs/extensions/example-debuggers
相关文章
- 暂无相关文章
用户点评