Vue 全宇宙最浪 VSCode 配置、插件
别人的那一堆配置、插件我就不写了~
首先进入官网下载并安装。
基本配置
- 在编译器 文件 >> 首选项 >> 设置,可以拷贝相面的选项后搜索相关配置
- 设置制表符等于空格数为 2: "editor.tabSize": 2
- 设置文件末尾增加新行:"files.insertFinalNewline": true
- 默认换行符:"files.eol": "\n
- 保存文件剪切尾随空格:"files.trimTrailingWhitespace": true
- 文件字符集编码: "files.encoding": "utf8"
使用配置文件
项目跟路径增加配置文件 .vscode/settings.json
将你的编辑器按照下面的配置进行设置,以避免常见的代码不一致和差异:
用两个空格代替制表符(soft-tab 即用空格代表 tab 符)。
保存文件时,删除尾部的空白符。
设置文件编码为 UTF-8。
在文件结尾添加一个空白行。
{
"editor.tabSize": 2,
"files.insertFinalNewline": true,
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"eslint.autoFixOnSave": true,
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
{
"language": "vue",
"autoFix": true
},
"html"
],
"prettier.stylelintIntegration": true,
"prettier.eslintIntegration": true,
"vetur.format.defaultFormatter.html": "prettier",
"vetur.format.defaultFormatterOptions": {
"prettier": {
"semi": true,
"singleQuote": true,
"arrowParens": "always",
"trailingComma": "es5"
}
},
"path-intellisense.mappings": {
"@/": "${workspaceRoot}/src/"
}
}
增加 .editorconfig 文件
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
必要的插件
https://marketplace.visualstudio.com/
- Prettier - Code formatter:代码格式化 https://prettier.io/
- htmlhint:html 语法检查 https://github.com/htmlhint/HTMLHint
- ESLint:javascript 语法检查 https://eslint.org/
"prettier.eslintIntegration": true,
- stylelint:css 语法检查 https://stylelint.io/
"prettier.stylelintIntegration": true
Vetur:vue 开发工具,增加以下配置 https://vuejs.github.io/vetur/formatting.html#formatters
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
},
],
"vetur.validation.template": false,
"vetur.format.defaultFormatter.html": "prettyhtml"
处理 prettier 格式化配置
"vetur.format.defaultFormatterOptions": {
"prettier": {
"semi": true,
"singleQuote": true,
"arrowParens": "always"
}
},
如果需要,路径 @/component/HelloWorld.vue eslint 解析出错时增加一下配置:
settings: {
"import/resolver": {
webpack: {
config: {
resolve: {
alias: {
'@': path.resolve('src'),
}
}
}
},
},
},
- vscode-icons:文件类型 icon
- Path Intellisense:自动路劲补全
- markdownlint:markdown 语法检查
- Settings Sync:编辑器配置、插件不同设备间同步
- Live Server:web 服务器
- vim:vim 方式开发(可选)
- svn:Subversion source control for VS Code
- px2rem:转换 css 样式的 px 为 rem 单位
- sftp:sftp sync extension for VS Code
- Import Cost:测量引入组件包大小,Vue 单文件组件需要增加以下配置:
"importCost.javascriptExtensions": [
"\\.jsx?$",
"\\.vue?$"
],
备注
eslint 自动处理语法问题:
Ctrl+Shift+p
输入:eslint:fix all
回车后 eslint 会自动处理一些语法问题
Vue 全宇宙最浪 VSCode 配置、插件的更多相关文章
- 二、vue之 使用vscode配置
vue之 使用vscode配置 visual studio code 简称vscode,下图为图标 ... 开启vscode ... 1.导入文件夹,选择菜单栏 文件-打开文件夹->选择相应已 ...
- VSCode配置简单的vue项目
VSCode配置简单的vue项目 https://www.cnblogs.com/wnxyz8023/p/9989447.html 由于最近要使用的项目框架为前后端分离的,采用的是vue.js+web ...
- 在.vue文件中让html代码自动补全的方法(支持vscode)
在.vue文件中让html代码自动补全的方法(支持vscode) https://blog.csdn.net/qq_36529459/article/details/79196763 "fi ...
- 在不同电脑设备之间, 同步 VSCode 的插件和配置
前提有一个码云或者github的账户,以下是我用github的示例(只有第二步不一样): Step1. 安装 同步插件"Settings Sync" Step2. 进入github ...
- vscode eslint插件对vue文件无效
vscode配置好了之后,只对.js文件提示 vue文件没有效果 改成如下配置就好了. "eslint.validate": [ "javascript", & ...
- VSCode配置Go插件和第三方拓展包
前言 VSCode现在已经发展的相当完善,很多语言都比较推荐使用其来编写,Go语言也一样,前提你电脑已经有了Go环境和最新版本的VSCode 插件安装 直接在拓展插件中搜索Go,就可以安装Go插件 安 ...
- vscode 配置 Pug Compile Hero Pro 插件步骤
这个随笔主要介绍 vscode 配置 Pug Compile Hero Pro 插件的步骤,实现快速使用less 以及 scss 等的编程语言 第一步 当然是安装我们的插件啦! 在插件商店里 搜 Sa ...
- vscode 常用插件安装
设置中文语言使用快捷键[Ctrl+Shift+P],弹出的搜索框中输入[configure language],然后选择搜索出来的[Configure Display Language],locale ...
- 最全的Visual Studio Code配置及使用教程
史上最全vscode配置使用教程 工欲善其事,必先利其器.想要优雅且高效的编写代码,必须熟练使用一款前端开发工具.但前端开发工具数不胜数,像HBuilder.Sublime Text.WebStorm ...
随机推荐
- 异步(async)编程
思考:为什么要使用异步编程? 我们先看看同步方法和异步方法之前在程序中执行的逻辑: 1. 同步方法 static void Main(string[] args) { Console.WriteLin ...
- C002:计算球体体积(半径固化)
程序: #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { float sphereRadius=10.0f; f ...
- Cassandra Vnodes在Cassandra 2.0-4.0中的演进
Vnodes简短历史 Vnodes又叫Virtual Nodes.是Cassandra在1.2版本里引入的功能,已经在生产环境中使用了近8年了.从2.0版本开始,因为默认配置里num_tokens一般 ...
- [算法]求满足要求的进制(辗转相除(欧几里得算法),求最大公约数gcd)
题目 3在十进制下满足若各位和能被3整除,则该数能被3整除. 5在十六进制下也满足此规律. 给定数字k,求多少进制(1e18进制范围内)下能满足此规律,找出一个即可,无则输出-1. 题解 写写画画能找 ...
- Sql Server之ORDER BY不规则排序.如:中文月份排序
ORDER BY CASE Month WHEN '一月' THEN 1 WHEN '二月' THEN 2 WHEN '三月' THEN 3 WHEN '四月' THEN 4 WHEN '五月' TH ...
- Prometheus Metrics 设计的最佳实践和应用实例,看这篇够了!
Prometheus 是一个开源的监控解决方案,部署简单易使用,难点在于如何设计符合特定需求的 Metrics 去全面高效地反映系统实时状态,以助力故障问题的发现与定位.本文即基于最佳实践的 Metr ...
- SSO单点登录可以自己实现吗?--开源软件诞生10
ERP与SSO的恩怨情仇--第10篇 用日志记录“开源软件”的诞生 赤龙 ERP 开源地址: 点亮星标,感谢支持,与开发者交流 kzca2000 码云:https://gitee.com/redrag ...
- Ansible基础认识及安装(1)
Ansible简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric)的优点,实现了批量系统配置.批量 ...
- tomact在windows系统下安装
一.下载 下载地址: https://tomcat.apache.org/download-90.cgi 7,8,9的版本都可以下,这里下载最新版本 注意:Binary是编译好的,可以直接使用的版本, ...
- ftp客户端自动同步 Windows系统简单操作ftp客户端自动同步
服务器管理工具它是一款功能强大的服务器集成管理器,包含win系统和linux系统的批量连接,vnc客户端,ftp客户端等等实用功能.我们可以使用这款软件的ftp客户端定时上传下载的功能来进实现ftp客 ...