Visual Studio Code同时debug多种代码的方式

今天看了一下,猜应该是configurations里面多写一个就行,试了下,真的可以同时debug PythonGo代码。

可以打断点、单步执行PythonGo代码。

launch.json 如下

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        },
        {
            "name": "Go: 当前文件",
            "type": "go",
            "request": "launch",
            "program": "${file}",
            "mode": "auto"
            
        }
    ]
}

 然后在DEBUG后面选择用哪一个配置跑就行了。

只是还有两点觉得做得不太好的地方,

一是 watch里面不会显示nil值,而是显示类型。

二是 不知道是否因为加了watch,两个变量都会在未初始化的时候报错,感觉像IDE的bug。

Failed to eval expression: { "Expr": "f2", "Scope": { "goroutineID": 1, "frame": 0 }, "Cfg": { "followPointers": true, "maxVariableRecurse": 1, "maxStringLen": 64, "maxArrayValues": 64, "maxStructFields": -1 } } Eval error: could not find symbol value for f2

Failed to eval expression: { "Expr": "f", "Scope": { "goroutineID": 1, "frame": 0 }, "Cfg": { "followPointers": true, "maxVariableRecurse": 1, "maxStringLen": 64, "maxArrayValues": 64, "maxStructFields": -1 } } Eval error: could not find symbol value for f

 

原文地址:https://www.cnblogs.com/lionfight/p/10964963.html