VScode用户设置

1. 打开设置

文件--首选项--设置,打开用户设置。VScode支持选择配置,也支持编辑setting.json文件修改默认配置。个人更倾向于编写json的方式进行配置,下面会附上我个人的配置代码

这里解析几个常用配置项:

(1)editor.fontsize用来设置字体大小,可以设置editor.fontsize : 14;

(2)files.autoSave这个属性是表示文件是否进行自动保存,推荐设置为onFocusChange——文件焦点变化时自动保存。

(3)editor.tabCompletion用来在出现推荐值时,按下Tab键是否自动填入最佳推荐值,推荐设置为on;

(4)editor.codeActionsOnSave中的source.organizeImports属性,这个属性能够在保存时,自动调整 import 语句相关顺序,能够让你的 import 语句按照字母顺序进行排列,推荐设置为true,即"editor.codeActionsOnSave": { "source.organizeImports": true };

(5)editor.lineNumbers设置代码行号,即editor.lineNumbers :true;

 

  文件>首选项>设置 > 搜索workbench.settings.editor,选中json即可改成json设置;


{ "files.associations": { "*.vue": "vue", "*.wpy": "vue", "*.wxml": "html", "*.wxss": "css" }, "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe", "git.enableSmartCommit": true, "git.autofetch": true, "emmet.triggerExpansionOnTab": true, "emmet.showAbbreviationSuggestions": true, "emmet.showExpandedAbbreviation": "always", "emmet.includeLanguages": { "vue-html": "html", "vue": "html", "wpy": "html" }, //主题颜色 //"workbench.colorTheme": "Monokai", "git.confirmSync": false, "explorer.confirmDelete": false, "editor.fontSize": 14, "window.zoomLevel": 1, "editor.wordWrap": "on", "editor.detectIndentation": false, // 重新设定tabsize "editor.tabSize": 2, //失去焦点后自动保存 "files.autoSave": "onFocusChange", // #值设置为true时,每次保存的时候自动格式化; "editor.formatOnSave": false, //每120行就显示一条线 "editor.rulers": [ ], // 在使用搜索功能时,将这些文件夹/文件排除在外 "search.exclude": { "**/node_modules": true, "**/bower_components": true, "**/target": true, "**/logs": true, }, // 这些文件将不会显示在工作空间中 "files.exclude": { "**/.git": true, "**/.svn": true, "**/.hg": true, "**/CVS": true, "**/.DS_Store": true, "**/*.js": { "when": "$(basename).ts" //ts编译后生成的js文件将不会显示在工作空中 }, "**/node_modules": true }, // #让vue中的js按"prettier"格式进行格式化 "vetur.format.defaultFormatter.html": "js-beautify-html", "vetur.format.defaultFormatter.js": "prettier", "vetur.format.defaultFormatterOptions": { "js-beautify-html": { // #vue组件中html代码格式化样式 "wrap_attributes": "force-aligned", //也可以设置为“auto”,效果会不一样 "wrap_line_length": 200, "end_with_newline": false, "semi": false, "singleQuote": true }, "prettier": { "semi": false, "singleQuote": true } } }

1、View In Browser

在浏览器里预览网页必备。运行html文件

2、vscode-icons

改变编辑器里面的文件图标

3、Bracket Pair Colorizer

给嵌套的各种括号加上不同的颜色。

4、Auto Rename Tag

自动修改匹配的 HTML 标签。

5、Path Intellisense

智能路径提示,可以在你输入文件路径时智能提示。

6、Markdown Preview

实时预览 markdown。

7、stylelint

CSS / SCSS / Less 语法检查

8、Import Cost

引入包大小计算,对于项目打包后体积掌握很有帮助

9、Prettier

比Beautify更好用的代码格式化插件

Vue插件

vetur

语法高亮、智能感知、Emmet等

VueHelper

snippet代码片段

其它插件

1、CSScomb

CSS 书写顺序规则,这里我推荐腾讯 AollyTeam 团队的规范:

http://alloyteam.github.io/CodeGuide/#css-declaration-order​alloyteam.github.io

简单说下这个插件怎么用:

在项目的根目录下创建一个名为csscomb.json的文件,然后添加一些配置项。也可以将配置项写入项目的 package.json 文件中的 csscombConfig 字段。

至于添加的配置项,CSScomb 提供了示例配置文件:

https://github.com/csscomb/csscomb.js/blob/master/config/csscomb.json​github.com

其中的 sort-order 就是 CSS 属性书写顺序,可以按照自己遵循的规范设置,所以我直接替换成了腾讯的。

这个配置文件里面各个字段的作用可以戳这里查看:

csscomb/csscomb.js​github.com

2、Turbo Console Log

快捷添加 console.log,一键 注释 / 启用 / 删除 所有 console.log。这也是我最常用的一个插件

简单说下这个插件要用到的快捷键:

ctrl + alt + l 选中变量之后,使用这个快捷键生成 console.log
alt + shift + c 注释所有 console.log
alt + shift + u 启用所有 console.log
alt + shift + d 删除所有 console.log

3、GitLens

详细的 Git 提交日志。

Git 重度使用者必备,尤其是多人协作时:哪一行代码,何时、何人提交都有记录。

妈妈再也不用担心我背锅了!



  

posted on 2021-03-11 11:55  红野猪  阅读(108)  评论(0)    收藏  举报