Visual Studio Code 入门简介 常用插件介绍
本来是有配图的,好像那些服务器都挂了, 真是尴尬~
下载地址
常用插件介绍
中文插件
代码补全
<!-- 2018.3.8 v1.21 版本不需要把这个功能集成到里面去了, 所以不需要了 -->
- Auto Close Tag 自动关闭标签
- Auto Rename Tag 自动重命名标签
- HTML Snippets html代码片段
- JavaScript ES6 code snippets es6代码片段
- jQuery Code Snippets jQuery 代码片段
- Path Intellisense 自动补全路径
- Path Autocomplete 路径智能补全插件
- turbo Console Log log 调试,很好用
- Live Server 直接开启服务
- Live Sass Compiler 配合Live Server 爽爆,
不知道怎么使用可以参考大佬的讲解 https://www.youtube.com/watch...
一些设置
- Version Lens package.json 版本切换
- HTML CSS Class Completion 自动搜索工程下的所有class,并生成提示列表
- CSS Peek 跳转到css 定义
类似的插件还有
Class autocomplete for HTML
HTML CSS Support
- Guides 缩进辅助线
ps 其实可以不装这个插件,直接开启vscode 默认设置即可, 我一般使用 Indenticator 这个插件来配合 默认的设置即可
经过实验发现, 自带的缩进辅助线有一些bug,缩进到第四列的时候,缩进线会变大一倍,同理八列的时候也是一样的,应该是设计的时候就是这样的把
"editor.renderIndentGuides": true,
- Indenticator 高亮当前缩进辅助线
- filesize 在状态栏显示文件大小
- Rainbow Brackets 给括号添加颜色[不维护了, 建议添加下面那个]
类似的插件有
Bracket Pair Colorizer
Bracket Pair Colorizer 2 2 比较快, 但是不向后兼容
- Multiple clipboards for VSCode 多个剪切板 ctrl + alt + v
- SVG Viewer SVG查看器
- Image preview 图片查看器 很好用的
- Color Picker 取色器
- CodeMetrics 计算js 代码复杂度
- Output Colorizer 让集成的输出栏目字体高亮
- Code Spell Checker 代码拼写检查器
代码格式化
// 参考配置,全部配置请去往官网
// .prettierrc
{
"printWidth": 120, // 换行字符串阈值
"semi": false, // 句末加分号
"singleQuote": true, // 用单引号
"trailingComma": "none", // 最后一个对象元素加逗号
"bracketSpacing": true, // 对象,数组加空格
"jsxBracketSameLine": false, // jsx > 是否另起一行
"arrowParens": "avoid", // (x) => {} 是否要有小括号
"requirePragma": false, // 是否要注释来决定是否格式化代码
"proseWrap": "preserve" // 是否要换行
}
- stylelint css验证插件
- 温馨提示:
stylelint 默认没有验证规则,so,需要自己写配置了
已经封装好的验证插件 npm install stylelint-config-standard (相关设置可以在手册中查看,很详细,可以添加和修改相关规则)
- CSScomb CSS,Less,SCSS或Sass的编码样式格式化程序,作者又开始更新了, 开心
- ESLint Javascript代码校验
- TSLint TypeScript 代码校验
- Alignment alignment 对齐 很久没维护了, 不要装了把
- chang-case 命名格式化插件
- caniuse css兼容性查询
代码注释
- vscode-fileheader 添加javascript文件头部注释 这个插件很久不维护了, 推荐使用 koroFileHeader
- Document This TypeScript和JavaScript文件生成详细的JSDoc注释
- change-case js 命名转换 比如驼峰转化成小写的写法
- Output Colorizer 控制台主题插件
代码调试
- Debugger for Chrome 谷歌调试器 配置完成后,需要关闭谷歌浏览器之后再开启调试功能方可使用
- Code Runner 运行选中的代码
- Debugger for Firefox 火狐调试器
- REST Client http调试
代码测试
- Wallaby.js 一个测试框架
Markdown相关
- markdownlint Markdown 验证插件
- Auto-Open Markdown Preview Markdown实时预览
- Instant Markdown Markdown浏览器预览
浏览器相关
- View In Browser 在浏览器中查看html文件 快捷键 ctrl + f1 默认谷歌浏览器
- open in browser 上面那个不行就使用这个 快捷键 alt + b 默认谷歌浏览器
git相关插件
- Git History git 历史
- Git History Diff git diff 自己看说明
- Git Blame git Blame 看看是谁的锅
- GitLens gitLens 必装 ,超好用
- Better Merge 更好的处理git冲突
- Local History
本地代码的一个保存日志,在没有git,svn,或者很长时间没有提交过代码的情况下,感觉挺实用,再也不怕代码回滚
- GitHub Pull Requests GitHub Pull Requests 处理
sublime相关
- Monokai Extended Monokai个主题
- Sublime Text Keymap 同步sublime的快捷键
项目管理
按下 F1 输入 Edit Projects 如下编辑,一个json 对应的是一个需要打开的项目 , 配置完成之后可以通过 Project Manage: List Project Open选项来打开对应的项目
[
{
"name": "sass",
"rootPath": "E:\\sass",
"paths": [],
"group": ""
},
{
"name": "module",
"rootPath": "E:\\fff",
"paths": [],
"group": ""
}
]
同步相关配置和插件
- Settings Sync 同步Visual Studio Code的各种配置 发现同步效果不是很完美, 有些插件没有同步
vue相关
- vue 语法高亮
- Vue 2 Snippets Vue 2 Snippets代码片段
- vetur 自己看api把
- 如何配置并利用vsCode编写符合Standard标准的代码 vue如何配置并利用vsCode编写符合Standard标准的代码
- VueHelper Vue,Vue-router和Vuex的代码片段
- vue-beautify vue美化插件
娱乐性插件
- background 改变背景图片
- Emoji 添加表情
主题推荐
- vscode-icons 侧栏主题推荐
在命令模式下 输入 Screencast 方便进入演示模式,挺好玩的
- Screencast 演示模式 Screencast 演示模式
GIT 功能区
- 按照提示操作就好,甘怕铁
degugger API
一些快捷键 (基于sublimeTestkeymaps上的)
- ctrl + z 撤销
- ctrl + y 恢复
- ctrl + shift + u 打开输出面板
- ctrl + shift + y 打开控制台面板
- ctrl + l 选中当前行
- ctrl + o 打开当前文件根目录
- ctrl + q 快速切换
- ctrl + b 隐藏侧栏
- ctrl + shift + v md格式文件直接预览
- 以下设置需要修改快捷键
ctrl + shift + y 打开问题栏
ctrl + shift + u 打开输出栏
ctrl + shift + i 打开调式控制台
ctrl + shift + o 打开终端
- shift + f12 在函数名处按下此快捷键,可以快速查看函数的定义
常用lunch.json设置
调试静态文件
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://192.168.1.56:9999",
// 静态文件地址
"file": "${workspaceFolder}/index.html",
"webRoot": "${workspaceFolder}"
}
]
}
{
"version": "0.2.0",
"configurations": [{
"name": "local for Chrome",
"type": "chrome",
"request": "launch",
"webRoot": "${workspaceRoot}",
"file": "${file}"
},
{
"name": "service for Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:55555/${relativeFile}",
"webRoot": "${workspaceRoot}"
}
]
}
常用tasks.json设置
{
"version": "0.1.0",
"tasks": [{
"taskName": "gulp-service",
"command": "gulp",
"isShellCommand": true,
"windows": {
"args": [
"service"
]
}
}, {
"taskName": "gulp-size",
"command": "gulp",
"isShellCommand": true,
"windows": {
"args": [
"size"
]
}
}]
}
自定义代码片段的设置
- snippet设置
- vue 通用模版代码
{
"Print to console": {
"prefix": "initVue",
"body": [
"<template>",
" <div class=\"app-container\">",
" 初始化demo$0",
" </div>",
"</template>\n",
"<script>",
"export default {",
" components: {\n",
" },",
" filters: {",
" demoFilters(val) {}",
" },",
" props: {",
" demoProps: {",
" type: String,",
" default() {",
" return {}",
" }",
" }",
" },",
" data() {",
" return {}",
" },",
" watch: {",
" demoWatch(n) {\n",
" }",
" },",
" created() { },",
" methods() {\n",
" }",
"}",
"</script>\n",
"<style lang=\"scss\">\n",
"</style>",
],
"description": "vueTemplate",
"scope": "vue",
}
}
用户设置
个性设置,可自行更改
{
//当前参考线的颜色设置
"indenticator.color.dark": "#ff6700",
// 是否开启默认缩进辅助线
"editor.renderIndentGuides": true,
// 是否显示空格
"editor.renderWhitespace": "none",
//允许在任何文件中设置断点
"debug.allowBreakpointsEverywhere": true,
//允许内联显示调试信息
"debug.inlineValues": true,
//设置默认字体大小
"editor.fontSize": 16,
//迷你菜单是否开启
"editor.minimap.enabled": true,
//设置Beautify插件自执行[保存自动格式化]
"editor.formatOnSave": true,
"editor.tabCompletion": true,
//控制代码片段提示的位置
"editor.snippetSuggestions": "top",
//控制换行方式
"editor.wordWrap": "on",
//插件自动更新
"extensions.autoUpdate": true,
//自动保存
"files.autoSave": "afterDelay",
//修改fileheader模板
"fileheader.tpl": "/*\r\n *-------------------------------------------------------------\r\n * @File : Describe the file \r\n * @Author: {author} \r\n * @Email : qinyuanqiuse@gmail.com \r\n * @GitHub: qinyuanqiblog.github.io \r\n * @Date : {createTime} \r\n * @Last Modified by: {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n *-------------------------------------------------------------\r\n */\r\n",
//fileheader插件相关配置
"fileheader.Author": "QinYuanqi",
"fileheader.LastModifiedBy": "QinYuanqi",
//是否使用git
"git.enabled": false,
//设置外部终端路径
"terminal.external.windowsExec": "C:\\Users\\Public\\Desktop\\Cygwin64 Terminal",
//设置内部终端
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
//工作区主题
"workbench.colorTheme": "Monokai Extended",
//侧栏主题
"workbench.iconTheme": "vscode-icons",
//侧栏位置
"workbench.sideBar.location": "right",
"workbench.editor.closeOnFileDelete": false,
//工作区的一些个性化设置
"workbench.experimental.colorCustomizations": {
"statusBarBackground": "#0373ff",
//"editorWhitespaces": "#ff0000",
"editorCursor": "#ff0000"
// "editorLineNumbers": "#ff6803"
//"editorLineNumbers": "#b12457"
},
// 基于活动编辑器控制窗口标题。基于上下文替换变量:
// ${activeEditorShort}: 例如 myFile.txt
// ${activeEditorMedium}: 例如 myFolder/myFile.txt
// ${activeEditorLong}: 例如 /Users/Development/myProject/myFile.txt
// ${rootName}: 例如 myProject
// ${rootPath}: 例如 /Users/Development/myProject
// ${appName}: 例如 VS Code
// ${dirty}: 一个更新指示器,指示活动编辑器是否更新
// ${separator}: 一个条件分隔符("-"),仅在左右是具有值的变量时才显示
"window.title": "${appName}${separator}${rootName}${separator}${activeEditorShort}${dirty}",
"window.zoomLevel": 1,
//同步vscode 相关设置
"sync.gist": "95e43aca9aa1ae2925a7323cf31af974",
"sync.lastUpload": "2017-04-10T14:52:45.942Z",
"sync.version": 262,
"sync.lastDownload": "",
"sync.autoDownload": false,
"sync.autoUpload": false,
"sync.showSummary": true,
"sync.forceDownload": false,
"sync.anonymousGist": false,
"sync.host": "",
"sync.pathPrefix": "",
//Csscomb 自定义规则校验
"csscomb.preset": {
"exclude": [
".git/**",
"node_modules/**",
"bower_components/**"
],
// Whether to add a semicolon after the last value/mixin.
"always-semicolon": true,
// Set indent for code inside blocks, including media queries and nested rules.
"block-indent": " ",
// Unify case of hexadecimal colors.
"color-case": "lower",
// Whether to expand hexadecimal colors or use shorthands.
"color-shorthand": true,
// Unify case of element selectors.
"element-case": "lower",
// Add/remove line break at EOF.
"eof-newline": true,
// Add/remove leading zero in dimensions.
"leading-zero": false,
// Unify quotes style.
"quotes": "single",
// Remove all rulesets that contain nothing but spaces.
"remove-empty-rulesets": true,
// Set space after `:` in declarations.
"space-after-colon": " ",
// Set space after combinator (for example, in selectors like `p > a`).
"space-after-combinator": " ",
// Set space after `{`.
"space-after-opening-brace": "\n",
// Set space after selector delimiter.
"space-after-selector-delimiter": "\n",
// Set space before `}`.
"space-before-closing-brace": "\n",
// Set space before `:` in declarations.
"space-before-colon": "",
// Set space before combinator (for example, in selectors like `p > a`).
"space-before-combinator": " ",
// Set space before `{`.
"space-before-opening-brace": " ",
// Set space before selector delimiter.
"space-before-selector-delimiter": "",
// Set space between declarations (i.e. `color: tomato`).
"space-between-declarations": "\n",
// Whether to trim trailing spaces.
"strip-spaces": true,
// Whether to remove units in zero-valued dimensions.
"unitless-zero": true,
// Whether to align prefixes in properties and values.
"vendor-prefix-align": true,
// Sort properties in particular order.
"sort-order": [
// 参考腾讯的规范
[
"display",
"visibility",
"float",
"clear",
"overflow",
"overflow-x",
"overflow-y",
"clip",
"zoom"
],
[
"table-layout",
"empty-cells",
"caption-side",
"border-spacing",
"border-collapse",
"list-style",
"list-style-position",
"list-style-type",
"list-style-image"
],
[
"-webkit-box-orient",
"-webkit-box-direction",
"-webkit-box-decoration-break",
"-webkit-box-pack",
"-webkit-box-align",
"-webkit-box-flex"
],
[
"position",
"top",
"right",
"bottom",
"left",
"z-index"
],
[
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"-webkit-box-sizing",
"-moz-box-sizing",
"box-sizing",
"border",
"border-width",
"border-style",
"border-color",
"border-top",
"border-top-width",
"border-top-style",
"border-top-color",
"border-right",
"border-right-width",
"border-right-style",
"border-right-color",
"border-bottom",
"border-bottom-width",
"border-bottom-style",
"border-bottom-color",
"border-left",
"border-left-width",
"border-left-style",
"border-left-color",
"-webkit-border-radius",
"-moz-border-radius",
"border-radius",
"-webkit-border-top-left-radius",
"-moz-border-radius-topleft",
"border-top-left-radius",
"-webkit-border-top-right-radius",
"-moz-border-radius-topright",
"border-top-right-radius",
"-webkit-border-bottom-right-radius",
"-moz-border-radius-bottomright",
"border-bottom-right-radius",
"-webkit-border-bottom-left-radius",
"-moz-border-radius-bottomleft",
"border-bottom-left-radius",
"-webkit-border-image",
"-moz-border-image",
"-o-border-image",
"border-image",
"-webkit-border-image-source",
"-moz-border-image-source",
"-o-border-image-source",
"border-image-source",
"-webkit-border-image-slice",
"-moz-border-image-slice",
"-o-border-image-slice",
"border-image-slice",
"-webkit-border-image-width",
"-moz-border-image-width",
"-o-border-image-width",
"border-image-width",
"-webkit-border-image-outset",
"-moz-border-image-outset",
"-o-border-image-outset",
"border-image-outset",
"-webkit-border-image-repeat",
"-moz-border-image-repeat",
"-o-border-image-repeat",
"border-image-repeat",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height"
],
[
"font",
"font-family",
"font-size",
"font-weight",
"font-style",
"font-variant",
"font-size-adjust",
"font-stretch",
"font-effect",
"font-emphasize",
"font-emphasize-position",
"font-emphasize-style",
"font-smooth",
"line-height",
"text-align",
"-webkit-text-align-last",
"-moz-text-align-last",
"-ms-text-align-last",
"text-align-last",
"vertical-align",
"white-space",
"text-decoration",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-style",
"text-emphasis-position",
"text-indent",
"-ms-text-justify",
"text-justify",
"letter-spacing",
"word-spacing",
"-ms-writing-mode",
"text-outline",
"text-transform",
"text-wrap",
"-ms-text-overflow",
"text-overflow",
"text-overflow-ellipsis",
"text-overflow-mode",
"-ms-word-wrap",
"word-wrap",
"-ms-word-break",
"word-break"
],
[
"color",
"background",
"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader",
"background-color",
"background-image",
"background-repeat",
"background-attachment",
"background-position",
"-ms-background-position-x",
"background-position-x",
"-ms-background-position-y",
"background-position-y",
"-webkit-background-clip",
"-moz-background-clip",
"background-clip",
"background-origin",
"-webkit-background-size",
"-moz-background-size",
"-o-background-size",
"background-size"
],
[
"outline",
"outline-width",
"outline-style",
"outline-color",
"outline-offset",
"opacity",
"filter:progid:DXImageTransform.Microsoft.Alpha(Opacity",
"-ms-filter:\\'progid:DXImageTransform.Microsoft.Alpha",
"-ms-interpolation-mode",
"-webkit-box-shadow",
"-moz-box-shadow",
"box-shadow",
"filter:progid:DXImageTransform.Microsoft.gradient",
"-ms-filter:\\'progid:DXImageTransform.Microsoft.gradient",
"text-shadow"
],
[
"-webkit-transition",
"-moz-transition",
"-ms-transition",
"-o-transition",
"transition",
"-webkit-transition-delay",
"-moz-transition-delay",
"-ms-transition-delay",
"-o-transition-delay",
"transition-delay",
"-webkit-transition-timing-function",
"-moz-transition-timing-function",
"-ms-transition-timing-function",
"-o-transition-timing-function",
"transition-timing-function",
"-webkit-transition-duration",
"-moz-transition-duration",
"-ms-transition-duration",
"-o-transition-duration",
"transition-duration",
"-webkit-transition-property",
"-moz-transition-property",
"-ms-transition-property",
"-o-transition-property",
"transition-property",
"-webkit-transform",
"-moz-transform",
"-ms-transform",
"-o-transform",
"transform",
"-webkit-transform-origin",
"-moz-transform-origin",
"-ms-transform-origin",
"-o-transform-origin",
"transform-origin",
"-webkit-animation",
"-moz-animation",
"-ms-animation",
"-o-animation",
"animation",
"-webkit-animation-name",
"-moz-animation-name",
"-ms-animation-name",
"-o-animation-name",
"animation-name",
"-webkit-animation-duration",
"-moz-animation-duration",
"-ms-animation-duration",
"-o-animation-duration",
"animation-duration",
"-webkit-animation-play-state",
"-moz-animation-play-state",
"-ms-animation-play-state",
"-o-animation-play-state",
"animation-play-state",
"-webkit-animation-timing-function",
"-moz-animation-timing-function",
"-ms-animation-timing-function",
"-o-animation-timing-function",
"animation-timing-function",
"-webkit-animation-delay",
"-moz-animation-delay",
"-ms-animation-delay",
"-o-animation-delay",
"animation-delay",
"-webkit-animation-iteration-count",
"-moz-animation-iteration-count",
"-ms-animation-iteration-count",
"-o-animation-iteration-count",
"animation-iteration-count",
"-webkit-animation-direction",
"-moz-animation-direction",
"-ms-animation-direction",
"-o-animation-direction",
"animation-direction"
],
[
"content",
"quotes",
"counter-reset",
"counter-increment",
"resize",
"cursor",
"-webkit-user-select",
"-moz-user-select",
"-ms-user-select",
"user-select",
"nav-index",
"nav-up",
"nav-right",
"nav-down",
"nav-left",
"-moz-tab-size",
"-o-tab-size",
"tab-size",
"-webkit-hyphens",
"-moz-hyphens",
"hyphens",
"pointer-events"
]
]
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。