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
}
相关推荐
摇滚侠2 天前
IDEA 创建 Java 项目 手动整合 SSM 框架
java·ide·intellij-idea
何以解忧,唯有..2 天前
Go语言循环语句详解:for、range与循环控制
开发语言·算法·golang
霸道流氓气质2 天前
Trae IDE 新手入门指南
ide
踏着七彩祥云的小丑2 天前
Go学习第9天:并发编程 + 文件操作 + 正则表达式
学习·golang·正则表达式·go
JCGKS2 天前
Go `init` 函数:包初始化顺序到底是怎样的
golang·init·init执行顺序
何以解忧,唯有..2 天前
Go语言中的const:常量声明与iota枚举详解
java·开发语言·golang
爱就是恒久忍耐2 天前
VSCode里如何比较2个branch
ide·vscode·编辑器
意法半导体STM322 天前
【官方原创】如何为STM32CubeMX2配置Visual Studio Code配置方案
vscode·stm32·单片机·嵌入式硬件·策略模式·stm32cubemx·嵌入式开发
bloglin999992 天前
vscode中可视化的合并分支,在“合并编辑器中解析”中“与基线进行比较”是什么意思
ide·vscode·编辑器
终将老去的穷苦程序员2 天前
IntelliJ IDEA 的安装教程
java·ide·intellij-idea