当前位置:网站首页>普歌-码上鸿鹄团队-Vscode 代码格式化整理
普歌-码上鸿鹄团队-Vscode 代码格式化整理
2022-07-15 14:47:00 【~柚子味的诗~】
vs code 代码格式化整理
vs code格式化代码的快捷键如下: (来源地址)
- On Windows Shift + Alt + F
- On Mac Shift + Option + F
- On Ubuntu Ctrl + Shift + I
1、代码格式化为eslint风格
链接: (安装插件参考这里)
需要插件:eslint
在设置中添加:
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
],
eslint.autoFixOnSave 用来进行保存时自动格式化,但是默认只支持 javascript .js 文件。
eslint.validate 用来配置作用的文件类型。
然后在保存代码的时候,就会自动格式化为eslint风格(需要保存多次)。
2、HTML格式化代码缩进
需要插件:Vetur
链接: (安装Vetur参考这里)
安装这个插件后,可以在设置中看到如下的内容:

为了让HTML代码可以格式化缩进,添加如下一条:
"vetur.format.defaultFormatter.html": "prettier"
用格式化代码的快捷键就可以
边栏推荐
- 巴比特 | 元宇宙每日必读:腾讯新闻暂停数字藏品的售卖服务,用户留言要求“退款”,幻核也陷入“滞销”困境,这释放了什么信息?...
- 1035. 不相交的线
- C#静态方法和非静态方法
- 基于ABP实现DDD--聚合和聚合根实践
- Cookies and sessions
- 【SQL注入】堆叠注入
- Pat grade a a1094 the largest generation
- Cyclic multi-Variate Function for Self-Supervised Image Denoising by Disentangling Noise from Image
- 一文搞懂│什么是跨域?如何解决跨域?
- ASTM E595-15(2021) Outgassing除气测试最新标准
猜你喜欢
随机推荐
u-boot之start.S分析(二)
Generate XML file of VOC dataset
718. Longest repeating subarray
1143. Longest common subsequence
2022.07.11
二叉树的性质和遍历
Top level makefile analysis of u-boot (2) config Generation of MK file
一种新的UI测试方法:视觉感知测试
Pat grade a a1086 tree traversals again
工程仪器振弦无线采集仪的采集数据发送方式及在线监测系统
机器学习引言
A solution to the failure of NVIDIA SMI command
LeNet
简单题目汇总
u-boot之顶层Makefile分析(二)之config.mk文件的生成
log4j.properties 日志详解
718. 最长重复子数组
EN 1090-1钢结构和铝结构施工结构构件—CE认证
WPS关闭烦人广告
VirtualBox:SSH连接









