0%

vscode关于tab缩进空格

前言

pid: 87977950

VSCode的Tab代码缩进比较混乱,设置一下会比较好

现在的代码规范基本是使用空格作为Tab使用

GUI设置

  1. Ctrl+, 打开设置

  2. Tab设置为4空格

    1
    editor.tabSize
  3. 按下Tab时插入空格

    1
    editor.insertSpaces
  4. 关闭detect Indentation

    1
    editor.detectIndentation
  5. 保存文件时删除行末空格

    1
    files.trimTrailingWhitespace
  6. 编辑器中显示空格、Tab符号

    1
    renderControlCharacters
    1
    renderWhitespace

    选择all显示全部空格

使用setting.json设置

1
2
3
4
5
6
"editor.tabSize": 4,//tab为四个空格
"editor.insertSpaces": true //tab转为空格
"editor.detectIndentation": false, //关闭检测第一个tab后面就tab
"files.trimTrailingWhitespace": true, //保存文件删除多余空格
"editor.renderControlCharacters": true, //制表符显示->
"editor.renderWhitespace": "all", //空格显示...

后记

VSCode真的是越用越好用啊

♥️来之🇨🇳