Skip to content

六、vscode配置

json
{
	/*配置html css js的默认格式化程序*/
	"editor.defaultFormatter": "esbenp.prettier-vscode",
	/*配置prettier*/
	"prettier.printWidth": 120, // 超过最大值换行
	"prettier.tabWidth": 4, // 缩进字节数
	"editor.mouseWheelZoom": true,
	"prettier.semi": false,
	"prettier.useTabs": true, // 句尾添加分号
	"prettier.singleQuote": true, // 使用单引号代替双引号
	"prettier.proseWrap": "preserve", // 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行
	"prettier.arrowParens": "avoid", //  (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
	"prettier.bracketSpacing": true, // 在对象,数组括号与文字之间加空格 "{ foo: bar }"
	"prettier.eslintIntegration": false, //不让prettier使用eslint的代码格式进行校验
	"prettier.bracketSameLine": false, // 在jsx中把'>' 是否单独放一行
	"prettier.jsxSingleQuote": false, // 在jsx中使用单引号代替双引号
	"prettier.requireConfig": false, // Require a 'prettierconfig' to format prettier
	"prettier.stylelintIntegration": false, //不让prettier使用stylelint的代码格式进行校验
	"prettier.trailingComma": "es5", // 在对象或数组最后一个元素后面是否加逗号(在ES5中加尾逗号)
	"prettier.tslintIntegration": false, // 不让prettier使用tslint的代码格式进行校验
	/*配置编辑器 看个人习惯配置*/

	/*配置js*/
	"javascript.format.insertSpaceBeforeFunctionParenthesis": true, //  #让函数(名)和后面的括号之间加个空格
	"javascript.format.insertSpaceAfterConstructor": true, // 在构造函数和括号之间加空格
	"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": true,
	"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": true,
	"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": true,
	"javascript.format.insertSpaceAfterSemicolonInForStatements": true,
	"javascript.format.insertSpaceBeforeAndAfterBinaryOperators": true, // 在二进制运算符之后定义空间处理。
	/*css的一些校验 可加可不加*/
	"css.lint.float": "warning",
	"css.lint.idSelector": "warning",
	// "css.lint.important": "warning",
	"css.lint.importStatement": "error",
	"css.lint.universalSelector": "warning",
	"less.lint.float": "warning",
	"scss.lint.idSelector": "warning",
	"scss.lint.hexColorLength": "warning",
	"scss.lint.float": "warning",
	"scss.lint.importStatement": "warning",
	"scss.lint.universalSelector": "warning",
	"vsicons.dontShowNewVersionMessage": true,
	"gitlens.graph.dimMergeCommits": true,

	"git.confirmSync": false,
	"diffEditor.ignoreTrimWhitespace": false,
	"Lingma.LocalStoragePath": "C:\\Users\\Administrator\\.lingma",
	"vscode-office.editorTheme": "Auto",

	// workbench
	"workbench.list.smoothScrolling": true, //使文件列表滚动变平滑
	"workbench.editor.enablePreview": false, //在编辑一个文件时打开编辑另一个文件不会覆盖当前编辑的文件而是新建一个标签页
	"workbench.startupEditor": "none", //打开时默认打开一个空白页
	"workbench.layoutControl.enabled": false, //关闭工作区布局控制
	"workbench.activityBar.location": "top", //左侧工具栏位置

	// editor
	"editor.suggest.snippetsPreventQuickSuggestions": false, // 除了 `Tab` 键以外, `Enter` 键是否同样可以接受建议
	"editor.acceptSuggestionOnEnter": "smart", // 这能减少“插入新行”和“接受建议”命令之间的歧义
	"editor.suggestSelection": "recentlyUsedByPrefix", // 默认情况下,建议列表中的建议将按字母顺序排列。如果启用此选项,则建议列表中的建议将按最近使用的顺序排列。
	"editor.detectIndentation": false, // 禁用自动检测缩进
	"editor.tabSize": 2, // 默认情况下,编辑器使用制表符大小来缩进。如果启用此选项,则编辑器将使用空格字符来缩进。
	"editor.wordWrap": "on", // 启用自动换行
	"editor.lineHeight": 1.5, // 行高
	"editor.guides.bracketPairs": true, // 括号高亮匹配
	"editor.bracketPairColorization.enabled": true, // 括号高亮匹配
	"editor.smoothScrolling": true, // 滚动条丝滑滚动
	"editor.cursorBlinking": "expand", // 使编辑器光标的闪烁平滑,有呼吸感
	"editor.cursorSmoothCaretAnimation": "on", // 让光标移动、插入变得平滑
	"editor.fontVariations": false, // 启用字体变体
	"editor.stickyScroll.enabled": false, // 启用粘性滚动
	"editor.codeActionsOnSave": {}, // 保存时自动格式化
	"editor.formatOnPaste": true, // 粘贴时格式化代码
	"editor.formatOnSave": true, // 每次保存的时候将代码按格式进行修复
	"editor.formatOnType": true, // 敲完一行代码自动格式化
	"editor.insertSpaces": false, //tab时不插入空格
	"editor.tabCompletion": "on", //启用Tab补全
	"editor.autoClosingBrackets": "beforeWhitespace", //括号自动补全
	"editor.fontLigatures": true, //启用字体连字
	"editor.linkedEditing": true, //html标签自动重命名(喜大普奔!终于不需要Auto Rename Tag插件了!)
	"editor.autoClosingDelete": "always", //括号自动补全
	"editor.autoClosingOvertype": "always", //括号自动补全
	"editor.autoClosingQuotes": "beforeWhitespace", // 自动保存
	// explorer
	"explorer.confirmDelete": false, //删除文件时不弹出确认弹窗
	"explorer.compactFolders": false, // 文件夹紧凑显示
	"explorer.confirmDragAndDrop": false, // 拖拽文件到文件夹时,是否弹出确认框
	"explorer.confirmPasteNative": false,
	//search
	"search.followSymlinks": false, //据说可以减少vscode的CPU和内存占用
	// window
	"window.dialogStyle": "custom", // 使用更具有VSCode的UI风格的弹窗提示(更美观)
	"window.commandCenter": false, // 启用窗口命令中心
	"window.zoomLevel": 0,
	"terminal.integrated.fontFamily": "monospace", // 窗口缩放等级
	"html.format.indentHandlebars": true, //在写包含形如{{xxx}}的标签的html文档时,也对标签进行缩进(更美观)
	"files.autoSave": "afterDelay", //自动保存
}

MIT Licensed