vscode开发调试js、python

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 git

     .gitignore文件过滤vscode git提交项

6.日志输出

       有几个程序运行过,就会在下面位置显示程序名称和运行日志

7.控制台

vscode控制台可切换,powershell控制台执行cmd命令会报错,切换成cmd即可

8.vscode调试器扩展

     参考:https://code.visualstudio.com/docs/extensions/example-debuggers

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

怪力左手

囧rz

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值