如何更改 Visual Studio Code 中的缩进? [英] How to change indentation in Visual Studio Code?

查看:32
本文介绍了如何更改 Visual Studio Code 中的缩进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于每个打字稿文件,visual studio code 使用 8 个空格的自动缩进.这对我的口味来说有点过分,但我找不到在哪里可以更改它.

也许它可以作为设置使用,但名称不同,因为我找不到与缩进相关的任何内容.

更新

我目前正在使用

然后,进行以下 2 处更改:(在搜索栏中键入 tabSize)

  1. 取消勾选Detect Indentation
  2. 将标签大小更改为 2/4(虽然我强烈认为 2 对 JS 来说是正确的 :))

For every typescript file visual studio code uses an auto indentation of 8 spaces. This is a bit too much for my taste but I can't find where to change it.

Maybe it's available as a setting but under a different name as I can't find anything related to indentation.

UPDATE

I'm currently using the Prettier code formatter and that solves all formatting problems by auto formatting on save (if there is no syntax error)

解决方案

You can change this in global User level or Workspace level.

Open the settings: Using the shortcut Ctrl , or clicking File > Preferences > Settings as shown below.

Then, do the following 2 changes: (type tabSize in the search bar)

  1. Uncheck the checkbox of Detect Indentation
  2. Change the tab size to be 2/4 (Although I strongly think 2 is correct for JS :))

这篇关于如何更改 Visual Studio Code 中的缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆