Visual Studio Code同時debug多種代碼的方式

今天看了一下,猜應該是configurations裏面多寫一個就行,試了下,真的能夠同時debug PythonGo代碼。python

能夠打斷點、單步執行PythonGo代碼。express

launch.json 以下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後面選擇用哪個配置跑就好了。spa

只是還有兩點以爲作得不太好的地方,debug

一是 watch裏面不會顯示nil值,而是顯示類型。code

二是 不知道是否由於加了watch,兩個變量都會在未初始化的時候報錯,感受像IDE的bug。orm

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 f2blog

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 fip

 

相關文章
相關標籤/搜索