How to set backspace in parentheses in sublime 3?

When I type action()and press return in parentheses, I get the following:

action (
    )

instead of this:

action (
)

How to change this?

I have this in my key bindings right now, but it only works in non-js files -

[
    { "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" }
      ]
    },
]
+6
source share
2 answers

If all else fails, you can write the snippet for yourself in such an elevated form (menu bar → Tools → developer → new snippet) and place the following code and save it.

<snippet>
    <content><![CDATA[
action(${1:}
)
]]></content>
    <tabTrigger>act</tabTrigger>
    <!-- <scope>source.JavaScript</scope> -->
</snippet>

This is a temporary solution, not the best. But for a while, this may work.

+4
source

, , , *.js ST3 Preferences > Settings - Syntax Specific. 2 .

"auto_indent": false,

. JavaScript action() return , .

+1

Source: https://habr.com/ru/post/1016621/


All Articles