一、打开方式命令面板运行“首选项打开用户设置 (JSON)”命令 (CtrlShiftP)打开settings.json文件来更改默认设置二、配置文件内容{ // 编辑器基本配置 // 设置编辑器字体大小为 16 editor.fontSize: 16, // 控制字体样式 editor.fontFamily: Droid Sans Mono, Courier New, monospace, Droid Sans Fallback, // vscode默认启用了根据文件类型自动设置tabsize的选项 editor.detectIndentation: false, // 重新设定 tab size 为 2 个空格 editor.tabSize: 2, // 启用 Tab 补全功能 editor.tabCompletion: on, // 启用单词换行 editor.wordWrap: on, // 显示括号对引导线 editor.guides.bracketPairs: true, // 光标动画平滑闪烁 editor.cursorBlinking: smooth, // 启用光标平滑移动 editor.cursorSmoothCaretAnimation: on, // 允许通过鼠标滚轮缩放编辑器字体大小 editor.mouseWheelZoom: true, // 粘贴代码时自动格式化 editor.formatOnPaste: true, // 输入时自动格式化 editor.formatOnType: true, // 保存文件时自动格式化 editor.formatOnSave: true, // 允许代码片段与快速建议同时显示 editor.suggest.snippetsPreventQuickSuggestions: false, // 智能接受建议 editor.acceptSuggestionOnEnter: smart, // 优先显示最近使用的建议 editor.suggestSelection: recentlyUsed // 启用编辑器内容的平滑滚动 editor.smoothScrolling: true, // 文件相关配置 // 设置文件编码为 gb2312适用于中文环境 files.encoding: gb2312, // 文件在延迟后自动保存 files.autoSave: afterDelay, // 自动检测文件编码 files.autoGuessEncoding: true, // 排除某些文件或目录的显示 files.exclude: { **/.classpath: true, **/.project: true, **/.settings: true, **/.factorypath: true }, // 工作台配置 // 设置文件关联指定 .exe 文件的默认打开方式为 default workbench.editorAssociations: { *.exe: default }, // 启动时显示的编辑器默认为 none 表示不自动打开任何编辑器 workbench.startupEditor: none, // 隐藏工作区的次要侧边栏默认设置为 hidden workbench.secondarySideBar.defaultVisibility: hidden, // 启用工作区列表如文件资源管理器的平滑滚动 workbench.list.smoothScrolling: true, // 控制侧边栏位置 workbench.sideBar.location: left, // 设置颜色主题 workbench.colorTheme: Default Dark, // Git 相关配置 // 启用 Git 自动保存功能确保代码变更及时提交 git.autofetch: true, // 启用 Git 同步确认提示 git.confirmSync: true, // C/C 配置 [c]: { // 设置 C 语言的默认格式化工具为 ms-vscode.cpptools editor.defaultFormatter: ms-vscode.cpptools }, [cpp]: { // 设置 C 语言的默认格式化工具为 ms-vscode.cpptools editor.defaultFormatter: ms-vscode.cpptools }, // Web 语言配置 [html]: { editor.defaultFormatter: vscode.html-language-features }, [css]: { editor.defaultFormatter: vscode.css-language-features }, [less]: { editor.defaultFormatter: vscode.css-language-features }, [javascript]: { editor.defaultFormatter: vscode.typescript-language-features }, // JavaScript/TypeScript 配置 // 让函数(名)和后面的括号之间加个空格 javascript.format.insertSpaceBeforeFunctionParenthesis: true, // TypeScript 格式化设置 typescript.format.insertSpaceAfterSemicolonInForStatements: false, // Prettier 配置 // 缩进字节数 prettier.tabWidth: 2, // 不使用 Tab使用空格 prettier.useTabs: false, // 句尾不添加分号 prettier.semi: false, // 使用单引号代替双引号 prettier.singleQuote: true, // 根据 Markdown 文本样式进行折行 prettier.proseWrap: preserve, // 箭头函数参数只有一个时省略括号 prettier.arrowParens: avoid, // 在对象、数组括号与文字之间加空格 prettier.bracketSpacing: true, // 不格式化 Vue 文件单独设置 prettier.disableLanguages: [ vue ], // 结尾换行符自动处理 prettier.endOfLine: auto, // 忽略某些文件的格式化 prettier.ignorePath: .prettierignore, // Vue/Vetur 配置 // 配置 Vetur 插件的 HTML 格式化工具 vetur.format.defaultFormatter.html: js-beautify-html, // 让 Vue 中的 JS 按编辑器自带的 TS 格式进行格式化 vetur.format.defaultFormatter.js: vscode-typescript, // Vetur 插件的格式化选项 vetur.format.defaultFormatterOptions: { js-beautify--html: { wrap_attributes: auto // 解决频繁换行问题 }, prettyhtml: { printWidth: 100, singleQuote: false, wrapAttributes: false, sortAttributes: false } }, // Emmet 配置 // 配置 Emmet 插件的语言映射 emmet.includeLanguages: { vue-html: html, vue: html, javascript: javascriptreact, wxml: html }, // ESLint 配置 // 每次保存的时候将代码按 eslint 格式进行修复 editor.codeActionsOnSave: { source.fixAll.eslint: true }, // ESLint 配置扩展 eslint.options: { extensions: [ .js, .vue ] }, // 搜索配置 // 排除某些文件或目录的搜索 search.exclude: { **/node_modules: true, **/bower_components: true, **/dist: true }, // 调试配置 // 在概览标尺中显示断点 debug.showBreakpointsInOverviewRuler: true, // 插件和功能配置 // 禁用 CMake 选项移动通知避免每次启动时弹出提示 cmake.showOptionsMovedNotification: false, // 关闭拖拽文件时的确认提示 explorer.confirmDragAndDrop: false, // 删除文件或目录时的确认提示 explorer.confirmDelete: true, // 使用自定义对话框样式 window.dialogStyle: custom, // 配置自动关闭标签的激活语言列表 auto-close-tag.activationOnLanguage: [ xml, php, blade, ejs, jinja, javascript, javascriptreact, typescript, typescriptreact, plaintext, markdown, vue, liquid, erb, lang-cfml, cfml, HTML (Eex) ], // 修改 IntelliCode 的建议选择行为 vsintellicode.modify.editor.suggestSelection: automaticallyOverrodeDefaultValue, // 设置终端环境变量OSX terminal.integrated.env.osx: {} }三、简易版C_Cpp.formatting: clangFormat, C_Cpp.clang_format_style: { BasedOnStyle: LLVM, BreakBeforeBraces: Allman, AllowShortFunctionsOnASingleLine: None, AlignConsecutiveMacros: { Enabled: true, AcrossEmptyLines: true, AcrossComments: true }, AlignConsecutiveAssignments: { Enabled: true, AcrossEmptyLines: false, AcrossComments: false }, AlignConsecutiveDeclarations: { Enabled: true, AcrossEmptyLines: false, AcrossComments: true, AlignFunctionDeclarations: false }, AlignTrailingComments: Always, AlignEscapedNewlines: Right, IndentWidth: 4, ColumnLimit: 0 }, [c]: { editor.defaultFormatter: ms-vscode.cpptools, editor.formatOnSave: true, editor.formatOnPaste: true }, [cpp]: { editor.defaultFormatter: ms-vscode.cpptools, editor.formatOnSave: true, editor.formatOnPaste: true },