【发布时间】:2016-09-24 12:55:51
【问题描述】:
在 Sublime Text 3 中,我在用户首选项中有 4 个制表符空格。这是设置文件的一部分:
{
...
// The number of spaces a tab is considered equal to
"tab_size": 4,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": false,
// If translate_tabs_to_spaces is true, use_tab_stops will make tab and
// backspace insert/delete up to the next tabstop
"use_tab_stops": true,
// Set to false to disable detection of tabs vs. spaces on load
"detect_indentation": true,
// Calculates indentation automatically when pressing enter
"auto_indent": true,
// Makes auto indent a little smarter, e.g., by indenting the next line
// after an if statement in C. Requires auto_indent to be enabled.
"smart_indent": true,
// Adds whitespace up to the first open bracket when indenting. Requires
// auto_indent to be enabled.
"indent_to_bracket": false,
// Trims white space added by auto_indent when moving the caret off the
// line.
"trim_automatic_white_space": true,
...
}
除了 Javascript 文件,它的制表符空间为 2 之外,它工作得很好。我不明白为什么。
有什么帮助吗?
我尝试创建 Javascript 特定的设置文件,但它也不起作用。
【问题讨论】:
-
你试图创建一个 JS 特定的设置文件是什么意思?你到底做了什么?它的内容是什么?你在哪里保存的?
-
还要注意您已将
detect_indentation设置为true,因此如果您打开使用2 个空格的现有文件,则会检测到并使用该文件。 -
确保您已设置正确的语法特定设置。某些语言具有特定的 JavaScript 语法,例如
Javascript (Rails)。检查状态栏的右下角,它应该告诉你当前的语法是什么。 -
可以确认这个问题仍然存在,但我猜我启用了一些插件,它破坏了“use_tab_stops”设置,Sublime Typescript 插件破坏它的方式:forum.sublimetext.com/t/…
标签: javascript sublimetext3 indentation