关于安全:Vscode-解决Golang无法跳转到定义

33次阅读

共计 1224 个字符,预计需要花费 4 分钟才能阅读完成。

首先,须要装置好 go 插件,插件市场搜寻 go,选一个即可装置。

而后,须要装置 go 的工具包。在 vscode 中,输出快捷键:command(ctrl) + shift + p,在弹出的窗口中,输出:go:install/Update Tools,回车后,抉择所有插件 (勾一下全选),点击确认,进行装置(设置 GOPROXY)。

接下来,在我的项目的 settings.json 文件中增加配置:

   "go.goroot": "D:\\Go",
    "go.gopath": "D:\\gopath",
    // 第三方库代码提醒
    "go.inferGopath": true,
    "go.formatTool": "goreturns",
    // 主动实现未导入的包
    "go.autocompleteUnimportedPackages": true,
    "go.gocodePackageLookupMode": "go",
    "go.gotoSymbol.includeImports": true,
    "go.docsTool": "gogetdoc",
    "go.useCodeSnippetsOnFunctionSuggest": true,
    "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
    "go.useLanguageServer": true,
    "": {"editor.formatOnSave": true,"editor.codeActionsOnSave": {"source.organizeImports": true,},    // Optional: Disable snippets, as they conflict with completion ranking.    "editor.snippetSuggestions": "none", 
    },"": {"editor.formatOnSave": true,"editor.codeActionsOnSave": {"source.organizeImports": true,},
    },"go.trace.server": "verbose", 
    "gopls": { 
        // Add parameter placeholders when completing a function. 
       "usePlaceholders": false, 
       // If true, enable additional analyses with staticcheck. 
       // Warning: This will significantly increase memory usage.   "staticcheck": false, 
    },"go.languageServerFlags": ["-remote=auto", "-logfile=auto", "-debug=:0", "-rpc.trace",], 

首选项 - 设置 去掉 Use Language Server

本文由博客一文多发平台 OpenWrite 公布!

正文完
 0