【无标题】

这篇博客详细介绍了如何配置Visual Studio Code (VSCode) 以优化Go语言的开发环境,包括设置GOPATH、GOROOT,以及各种插件和扩展的配置,如代码补全、格式化、错误检查、代码跳转、调试工具等,旨在提升开发效率和代码质量。
摘要由CSDN通过智能技术生成

@[TOC]VSCODE 的 go 配置

{
    "go.goroot": "D:\\Programs\\go",
    "go.gopath": "E:\\GoPrograms",
    "go.inferGopath": false,
    "go.toolsGopath": "E:\\GoPrograms",
    
    "window.zoomLevel": 0,
    "git.autofetch": true,
    //"terminal.integrated.shell.windows": "cmd.exe",	// 也可以使用 cmd.exe
    // "terminal.integrated.shellArgs.windows": [
    //     "/k",
    //     "D:\\Applications\\Cmder\\Cmder.exe"
    //  ],
//"workbench.colorTheme": "Monokai Pro (Filter Machine)",
    //"workbench.iconTheme": "Monokai Pro (Filter Machine) Icons",
    "editor.renderControlCharacters": false,
    "editor.snippetSuggestions": "top",
    "editor.suggest.snippetsPreventQuickSuggestions": true,
    "breadcrumbs.enabled": true,
    "terminal.explorerKind": "external",
    "editor.cursorStyle": "block",
    "editor.links": false,
    "editor.mouseWheelZoom": true,
    "editor.renderLineHighlight": "all",
    "editor.suggest.shareSuggestSelections": true,
    "outline.icons": true,
    "search.showLineNumbers": true,
    "search.smartCase": true,

    // package 查找模式
    "go.gocodePackageLookupMode": "go",
    "go.gotoSymbol.includeGoroot": true,
    "go.gotoSymbol.includeImports": true,

    // build 相关
    "go.buildOnSave": "off",
    "go.gocodeAutoBuild": true,
    "go.installDependenciesWhenBuilding": true,
    "go.buildFlags": [],
    "go.buildTags": "",
    "go.coverOnSingleTest": true,

    "go.useCodeSnippetsOnFunctionSuggest": true,

    "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
    
    "go.docsTool": "guru",
    "go.formatTool": "goimports",
    "go.lintTool": "golangci-lint",
    "go.lintOnSave": "package",
    "go.lintFlags": [
        "--fast"
    ],
    "go.formatFlags": [],
    "go.vetFlags": [],
    "go.vetOnSave": "package",
    "go.generateTestsFlags": [],
    
    "go.liveErrors": {
        "enabled": true,
        "delay": 500
    },
    "go.gocodeFlags": [
        "-builtin",
        "-ignore-case",
        "-unimported-packages"
    ],
    "go.enableCodeLens": {
        "references": true,
        "runtest": true
    },
    "go.delveConfig": {

        "dlvLoadConfig": {
            "followPointers": true,
            "maxVariableRecurse": 1,
            "maxStringLen": 64,
            "maxArrayValues": 64,
            "maxStructFields": -1
        },
        "apiVersion": 2,
        "showGlobalVariables": true
    },
    "go.editorContextMenuCommands": {
        "toggleTestFile": true,
        "addTags": true,
        "removeTags": true,
        "testAtCursor": true,
        "testFile": true,
        "testPackage": true,
        "generateTestForFunction": true,
        "generateTestForFile": true,
        "generateTestForPackage": true,
        "addImport": true,
        "testCoverage": true,
        "playground": true,
        "debugTestAtCursor": true
    },    
    "go.playground": {
        "openbrowser": false,
        "share": false,
        "run": false
    },
    "go.addTags": {
        "tags": "json",
        "options": "json=omitempty",
        "promptForTags": true,
        "transform": "snakecase"
    },
    "go.removeTags": {
        "tags": "",
        "options": "",
        "promptForTags": false
    },
    "[go]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": false
        },
    },
    "go.alternateTools": {
        "go-langserver": "gopls", 
    },
    "go.useLanguageServer": true,
    "go.languageServerFlags": [],

    "gopls": {
        "experimentalWorkspaceModule": true,
        "completeUnimported": true,
        "usePlaceholders": true,
        "completionDocumentation": true,
        "deepCompletion": true, 
        "matcher": "fuzzy",
        "hoverKind": "SynopsisDocumentation" // No/Synopsis/Full, default Synopsis
    },
    "go.toolsManagement.autoUpdate": true,

    // "go.languageServerExperimentalFeatures": {
    //     "format": true,
    //     "autoComplete": true,
    //     "rename": true,
    //     "goToDefinition": true,
    //     "hover": true,
    //     "signatureHelp": true,
    //     "goToTypeDefinition": true,
    //     "goToImplementation": true,
    //     "documentSymbols": true,
    //     "workspaceSymbols": true,
    //     "findReferences": true,
    //     "diagnostics": false
    // }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值