How to change the per-language configuration of setting “editor.insertSpaces” to “auto”

情到浓时终转凉″ 提交于 2019-12-21 03:19:14

问题


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.

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

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?


回答1:


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

example:

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

Update: editor.tabSize and editor.insertSpaces are now supported in version 1.10



来源:https://stackoverflow.com/questions/30057721/how-to-change-the-per-language-configuration-of-setting-editor-insertspaces-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!