vscode详细配置Go语言相关插件

06-01 1156阅读

文章目录

  • vscode详细配置Go语言
    • 1.插件介绍
      • 1.1 BetterCommments
      • 1.2GitGraph
      • 1.3Go
      • 1.4GoComment
      • 1.5goctl
      • 1.6Lowlight Go Errors
      • 1.7Markdown
      • 1.8Material Icon Theme
      • 1.9Preetier
      • 2.0Project Manager
      • 其它插件
      • 2.settings.json文件

        vscode详细配置Go语言

        1.插件介绍

        1.1 BetterCommments

        vscode详细配置Go语言相关插件

        注释友好,可以根据代码重要,来更改颜色,如;

        vscode详细配置Go语言相关插件

        1.2GitGraph

        vscode详细配置Go语言相关插件

        Git提交可视化界面,也非常友好,可以快速查看相关内容。但是我个人建议使用SourceTree和vscode结合起来使用,会更强大。

        下载地址:https://www.sourcetreeapp.com/

        1.3Go

        vscode详细配置Go语言相关插件

        >go:install/update tools下载Go所需要的包。

        1.4GoComment

        vscode详细配置Go语言相关插件

        快捷一键加Go中的注释类似注解。

        vscode详细配置Go语言相关插件

        1.5goctl

        vscode详细配置Go语言相关插件

        go_zero插件。官方地址:https://go-zero.dev/

        1.6Lowlight Go Errors

        vscode详细配置Go语言相关插件

        vscode中,if err!=nil{} 代码低亮模式。

        vscode详细配置Go语言相关插件

        1.7Markdown

        vscode详细配置Go语言相关插件

        1.8Material Icon Theme

        vscode详细配置Go语言相关插件

        1.9Preetier

        vscode详细配置Go语言相关插件

        2.0Project Manager

        vscode详细配置Go语言相关插件

        多个项目管理工具,避免来回切换项目。

        其它插件

        vscode详细配置Go语言相关插件

        vscode详细配置Go语言相关插件

        vscode详细配置Go语言相关插件

        vscode详细配置Go语言相关插件

        vscode详细配置Go语言相关插件

        2.settings.json文件

        {
          // UI 相关
          "workbench.colorTheme": "One Dark Pro",
          "workbench.iconTheme": "vscode-icons",
          "workbench.startupEditor": "none",
          "explorer.confirmDelete": false,
          // 编辑器基础设置
          "editor.fontSize": 14,
          "editor.lineHeight": 24,
          "editor.renderWhitespace": "none",
          "editor.tabSize": 2,
          "editor.formatOnSave": true,
          "editor.guides.bracketPairs": true,
          "editor.rulers": [80],
          "editor.fontFamily": "JetBrains Mono,Consolas, 'Courier New', monospace",
          "editor.fontLigatures": true,
          // 文件保存
          "files.autoSave": "afterDelay",
          "files.eol": "\n",
          // Vue 配置
          "[vue]": {
            "editor.defaultFormatter": "Vue.volar"
          },
          // HTML 和 CSS 配置
          "[html]": {
            "editor.defaultFormatter": "vscode.html-language-features"
          },
          "[css]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
          },
          // JavaScript/TypeScript 配置
          "[javascript]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
          },
          "[typescript]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
          },
          "[json]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
          },
          // Markdown 配置
          "[markdown]": {
            "diffEditor.ignoreTrimWhitespace": true
          },
          // Git 配置
          "git.autofetch": true,
          "git.confirmSync": false,
          "git.enableSmartCommit": true,
          "git.decorations.enabled": true,
          // Go 配置
          "go.gopath": "C:/Users/xz317/go",
          "go.goroot": "C:/WorkSpace/PluginsAllIn/g/g1.7.0.windows-amd64/go",
          "go.useLanguageServer": true,
          "go.languageServerFlags": [
            "-rpc.trace",
            "-logfile=C:/Users/xz317/AppData/Local/Temp/gopls.log"
          ],
          "go.formatTool": "goimports",
          "go.lintTool": "golangci-lint",
          "go.toolsManagement.autoUpdate": true,
          "go.alternateTools": {
          
          
          },
          // gopls 相关设置
          "gopls": {
            
            "usePlaceholders": true,
            "staticcheck": true,
            "analyses": {
              "fillreturns": true,
              "nonewvars": true,
              "undeclaredname": true,
              "unusedparams": true
            },
            "deepCompletion": true,
            "matcher": "fuzzy",
            "completeUnimported": true,
            "semanticTokens": true,
            "hoverKind": "FullDocumentation",
            "experimentalPostfixCompletions": true
          },
          // Go 代码格式化和导入管理
          "[go]": {
            "editor.formatOnSave": true,
            "editor.codeActionsOnSave": {
              "source.organizeImports": "explicit",
              "source.fixAll": "explicit"
            }
          },
          // 编辑器全局代码操作
          "editor.codeActionsOnSave": {
            "source.organizeImports": "always"
          },
          // Prettier 配置
          "prettier.singleQuote": true,
          "prettier.trailingComma": "all",
          "prettier.semi": true,
          // ESLint 配置
          "eslint.format.enable": true,
          "eslint.validate": [
            "javascript",
            "javascriptreact",
            "typescript",
            "typescriptreact",
            "vue"
          ],
          // YAML 配置
          "yaml.format.enable": true,
          "yaml.validate": true,
          "yaml.schemaStore.enable": true,
          // 其他工具 & 插件
          "Lingma.cloudModelAutoTriggerGenerateLength": "medium",
          "Lingma.cloudModelManualTriggerGenerateLength": "long",
          // 其他全局设置
          "diffEditor.ignoreTrimWhitespace": false,
          "RainbowBrackets.depreciation-notice": false,
          "extensions.ignoreRecommendations": true,
          "auto-rename-tag.activationOnLanguage": [
            "*"
          ],
          "workbench.settings.applyToAllProfiles": [
            "functionTemplate"
          ],
          "functionTemplate": "// ${func_name} \n// @receiver ${receiver_name_type}\n// @param ${param_name_type}\n// @return ${return_name_type}\n// @author ${git_name} \n// @date ${date}",
          "projectManager.openInNewWindowWhenClickingInStatusBar": true,
          "projectManager.sortList": "Path",
          "projectManager.confirmSwitchOnActiveWindow": "always",
          "projectManager.groupList": true,
          "diffEditor.hideUnchangedRegions.enabled": true
        }
        
免责声明:我们致力于保护作者版权,注重分享,被刊用文章因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理! 部分文章是来自自研大数据AI进行生成,内容摘自(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供学习参考,不准确地方联系删除处理! 图片声明:本站部分配图来自人工智能系统AI生成,觅知网授权图片,PxHere摄影无版权图库和百度,360,搜狗等多加搜索引擎自动关键词搜索配图,如有侵权的图片,请第一时间联系我们。

目录[+]

取消
微信二维码
微信二维码
支付宝二维码