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

文章目录

vscode详细配置Go语言

1.插件介绍

1.1 BetterCommments

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

1.2GitGraph

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

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

1.3Go

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

1.4GoComment

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

1.5goctl

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

1.6Lowlight Go Errors

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

1.7Markdown

1.8Material Icon Theme

1.9Preetier

2.0Project Manager

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

其它插件




2.settings.json文件

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
}
相关推荐
2501_916008894 小时前
iOS应用开发工具全面解析:如何选择与优化开发效率
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
ttwuai8 小时前
Cursor 生成 CRUD 后,Go 后台接口别只测 200:JWT、RBAC 和 tenant_id 怎么验
开发语言·后端·golang
布朗克16812 小时前
Go 入门到精通-31-编码与序列化
开发语言·qt·golang·编码与序列化
microrain15 小时前
从硬编码到热插拔:SagooIoT插件架构如何打破物联网平台的扩展瓶颈
物联网·golang·开源·sagooiot
csdn_aspnet15 小时前
如何将 Cursor MCP 与 VS Code 连接
vscode·cursor·mcp·composio
geovindu16 小时前
go:Backtracking Algorithm
开发语言·后端·算法·golang·回溯算法
qq_4523962316 小时前
第六篇:《并发编程核心:Goroutine 与 Channel》
golang
llwszx17 小时前
【Java/Go后端手撸原生Agent(第五篇):多工具并行调用 + BashTool执行引擎 + Judge证据链升级】
java·后端·golang·状态机·pydantic·agnet·llm-as-judge
FfHUCisI17 小时前
Go语言程序结构 —— 变量、声明与零值机制
golang
梦想的颜色18 小时前
2026 VibeCoding 工具链精选|IDE + 大模型成套组合推荐,按场景分级收录
ide·trae·ai 编程·vibecoding·国产海外 ai 编程方案·氛围编程成套配置·副业 ai 开发工具栈