Auto Syntax (Auto bracketing, quotes) DISABLE?


#1

How do I disable the automatic completion of brackets and quotes, along with the auto indentation for if statements and functions? It’s so annoying and wrong.


#2

Bracket matching is done by the Brackets package. I don’t know about indents.

BTW, why is it wrong?


#3

Because if I write an if statement, it’ll do this:

The brackets shouldn’t be indented like that…

Shouldn’t it be:

if ()
{

}


#4

I’ve disabled the brackets package.

If I write an if statement and hit enter, it’ll indent. Okay, fine.

But if after auto indenting I type a {, the bracket will stay indented, instead of removing the indent so the { is in line with the if. All other IDEs so this properly.


#5

Indentation patterns are currently controlled by the grammar. Most of the C-like grammars are written expecting a 1TBS style of brace placement:

if (1==1) {
    content();
}

for which the indentation would end up correct.


#6

How do I change the grammar for JavaScript?


#7

You can submit a Pull Request to the language-javascript package. On the other hand, if it were accepted that might just mean that your style of brace placement would work whereas the 1TBS style wouldn’t.

The real answer is to figure out a system whereby indentation hinting can be either:

  1. Separate from the grammar completely
  2. A single grammar can provide multiple indentation systems with a method for the user to choose between them

Of course, that’s a much more challenging and longer-term thing.


#8

Isn’t there something he can patch locally?


#9

Yes, language packages are packages just like any other. One can always use apm develop or more manual methods to create a local copy of the package and hack on it.