JetBrains WebStorm 忽略缩进设置 [英] JetBrains WebStorm ignores Indentation Settings

查看:39
本文介绍了JetBrains WebStorm 忽略缩进设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在<代码>设置>中代码风格JavaScript 我已经将 Tab sizeIndent 设置为 4.为什么 WebStorm 仍然忽略这些设置,正如您在预览窗口中看到的:

In Settings > Code Style > JavaScript I've set Tab size and Indent to 4. Why is WebStorm still ignoring these settings, as you can see in the preview window:

哪些设置可以覆盖这些?

What settings could override these?

推荐答案

如果您启用了 EditorConfig 插件(默认情况下应该是这样)并且在您的项目中有 .editorconfig 文件(或者甚至更高)项目根目录)然后那里的设置将覆盖您的代码样式(这是预期的,因为这是此类插件的全部内容).

If you have EditorConfig plugin enabled (which should be by default) and have .editorconfig files in your project (or maybe even above the project root) then settings from there will override your Code Style (which is expected as this is the whole point of such plugin).

为什么会有这种行为?可以做什么?

Why such behaviour? What can be done?

  1. 请检查 .editorconfig 文件的用途——它们是独立于编辑器的.这意味着覆盖您的内部设置以在使用的不同 IDE/编辑器之间提供一致性,而无需仅为该项目/文件夹配置您的 IDE/编辑器
  2. 您正在编辑代码样式设置,而不是实际的 EditorConfig 设置
  3. 使用 .editorconfig,您可以执行代码样式当前无法实现的操作(例如,针对不同文件类型的不同右边距/尾随空白处理,即使代码样式不支持它们)
  4. 代码样式适用于整个项目(所有文件),而 .editorconfig 可以针对每个子文件夹进行不同的配置,甚至可以排除.
  5. IDE 应该向您显示通知(使用浅色 GUI 主题,它会是编辑器窗口顶部的绿色条),它会告诉您editorconfig 文件覆盖您的代码样式设置"——我只是不确定是否它在 WebStorm v11 中可用..或者是仅从 v12 开始.
  6. 如果您在设置中上一级(只是 Code Style 而不是 Code Style > JavaScript 如您的屏幕截图),您会看到这一刻被提及为好吧
  7. 您可以在 JetBrains 的 问题跟踪器.
  1. Please check what .editorconfig files are for -- they meant to be editor-independent. It meant to override your internal settings to provide consistency across different IDEs/editors used without the need to configure your IDE/editor just for this project/folder
  2. You are editing Code Style settings and not actual EditorConfig settings
  3. With .editorconfig you can do things that are not currently possible with Code Style (e.g. different right margins / trailing white space handling per different file types, even if they are not supported by Code Style)
  4. Code Style is applied to the whole project (all files) while .editorconfig can be configured differently for each sub-folder and even have exclusions.
  5. IDE should be showing you the notice (using light GUI theme it would be green bar on top of the editor window) where it would tell that "editorconfig file overriding your Code Style settings" -- I'm just not sure if it's available in WebStorm v11 . .or is it since v12 only.
  6. If you go one level up in your settings (just Code Style and not Code Style > JavaScript as on your screenshot) you will see mention of this moment as well
  7. You may file Feature Request ticket for such "update .editorconfig file while editing Code Style" idea at JetBrains' Issue Tracker.

这篇关于JetBrains WebStorm 忽略缩进设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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