无法启动dlvdap
当我在 VSCode dlv dap 调试中启动时,我收到以下消息:
Couldn't start dlv dap:
Error:timed out while waiting for DAP server to start
我已经有了项目的启动配置?
午餐.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}",
"showLog": true,
"env": {
"GO111MODULE": "on"
}
}
]
}
和 setting.json 是:
{
"folders": [
{
"path": "."
}
],
"settings": {
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.autocompleteUnimportedPackages": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"explorer.confirmDelete": false,
"go.formatTool": "goimports",
"go.docsTool": "gogetdoc",
"go.buildFlags": [],
"explorer.confirmDragAndDrop": false,
"window.zoomLevel": 0.8,
"editor.minimap.enabled": false,
"go.useLanguageServer": true,
"go.delveConfig":{
"debugAdapter":"dlv-dap"
},
"[go]": {
"editor.snippetSuggestions": "none",
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"gopls": {
"experimentalWorkspaceModule": true,
"usePlaceholders": true, // add parameter placeholders when completing a function
"completionDocumentation": true // for documentation in completion items
}
},
}
项目的结构如图所示?
回答
这可能是由于最近更新了VS Code Go 扩展。
第一个选项是通过"Go: Install/Update Tools"从命令面板运行命令来修复它(Linux/Windows : Ctrl+ Shift+ P,Mac : ?+ ?+ P)。
然后,从菜单中标记dlv& dlv-dap,然后点击确定开始安装/更新。
Delve 的本机 DAP 实现正在积极开发中,因此请使用从其主分支构建的 Delve 来利用最新的功能和错误修复。Go 扩展将这个最新版本的 Delve与正式发布的 dlv 版本分开维护,并使用名称 dlv-dap 安装它。
第二种选择是使用旧式调试适配器。更多关于这个在下面的链接...
在https://github.com/golang/vscode-go/blob/master/docs/debugging.md查看完整文档