当我输入action()
并在括号之间点击返回时,我得到了这个:
action (
)
而不是:
action (
)
如何更改此内容?
我现在在我的键绑定中有这个,但它只适用于非js文件 -
[
{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }
]
},
{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true }
]
},
{ "keys": ["super+shift+\\"], "command": "reveal_in_side_bar"},
{"keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
[
{ "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
{ "match_all": true, "key": "selection_empty" },
{ "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
{ "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
{ "match_all": true, "key": "is_abbreviation" }
]
},
]
答案 0 :(得分:4)
如果没有任何效果,那么你可以像这样为自己写一个片段(菜单栏 - >工具 - >开发者 - >新片段)并输入以下代码并保存。
<snippet>
<content><![CDATA[
action(${1:}
)
]]></content>
<tabTrigger>act</tabTrigger>
<!-- <scope>source.JavaScript</scope> -->
</snippet>
这是一个临时的解决方案而不是最好的解决方案。但是暂时它可以工作。
答案 1 :(得分:1)
我让它工作的方式是,在ST3的* .js文件中,点击Preferences > Settings - Syntax Specific
。应打开一个带2个窗格的单独窗口。在右侧窗格中添加
"auto_indent": false,
括号和Save之间。当你回到JavaScript文件并输入action()
并在括号之间点击return时,应该没有更多的缩进。