如何更改设置"editor.insertSpaces"的每个语言的配置.到“自动" [英] How to change the per-language configuration of setting "editor.insertSpaces" to "auto"

查看:664
本文介绍了如何更改设置"editor.insertSpaces"的每个语言的配置.到“自动"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS Code编辑多种语言(主要是Ruby,PHP和Javascript)的项目,对于每种语言,我们都有不同的缩进模型(空格/制表符和宽度).看起来VS Code支持此功能,因为它允许将editor.insertSpaceseditor.tabSize都设置为"auto",这是每个语言的定义.

I'm using VS Code to edit projects in multiple languages (mostly Ruby, PHP and Javascript) and for each language we have different indentation models (spaces/tabs and width). Looks like VS Code supports this as it allows both editor.insertSpaces and editor.tabSize to be set to "auto" which is a per-language definition.

但是,尽管editor.tabSize看起来可以满足我的需求,但editor.insertSpaces始终在"auto"模式下插入空格.

But while editor.tabSize looks to do about what I want, editor.insertSpaces always insert spaces when in "auto" mode.

我试图找到可以在其中编辑每种语言配置的位置,但没有找到这种设置.我还查看了resources/app/client/vs/languages下的语言目录,但是没有找到指定这些功能的内容.

I've tried to find where one can edit the per-language configuration but have found no such setting. I've also looked in the language directories under resources/app/client/vs/languages but have failed to find something that specifies these features.

有什么想法如何自定义每种语言的设置?

Any idea how to customize the per-language settings?

推荐答案

要使用语言设置,请在方括号中使用[language_id]:

To use perlanguage settings, you use the [language_id] in square brackets:

示例:

{
  "[typescript]": {
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true
  },
  "[markdown]": {
    "editor.formatOnSave": true,
    "editor.wrappingColumn": 0,
    "editor.renderWhitespace": "all",
    "editor.acceptSuggestionOnEnter": false
  }
}

更新:版本 查看全文

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