Is there any way to change the way autocomplete place the curly brace?


#1

For reference I am using JavaScript.

Is there any way to make it so if I pick the autocomplete word, the curly brace would be aligned together vertically rather than like that? When I was coding in Java, IntelliJ had a setting to allow you to choose the brace syntax so I was wondering if Atom had something similar.

On another note what brace syntax do you personally use and why? I find that just looking straight vertically makes it easier to tell if a brace is missing. If you could tell me the pros for using the more common brace syntax then I may just switch.


#2

No, there currently is no way to change the brace style.

I’ve read many very well written justifications for various brace styles. They have all made decent cases for one being more readable than another. In my experience, the most readable style is the one you are most used to reading. In research into the memory of experts versus novices, it has been shown that experts depend on familiar patterns to memorize complex states. My theory is that expert programmers use these familiar patterns when reading code to understand it at a higher level than just line-by-line or subexpression-by-subexpression. But even when confronted with unfamiliar patterns, experts can adjust and get back up to speed:

Further, Chase and Simon (1973) showed that when an actual chess position was shown using an unfamiliar notation (see Panel C in Figure 1), the chess expert was able to display a similar level of superior memory performance after a brief period of adjustment. This result implies that the superior memory of experts is not photographic and requires arrangements of chess pieces that can be encoded using associations to the experts’ extensive knowledge of chess.

So, I adjust to using whatever brace style the project I’m working in uses and don’t worry about it so much as I used to :grinning:


#3

You can always download the language-javascript package source, put it in .atom/packages and edit the snippets in language-javascript.cson.

That’s how I did it with language-c to change it to my liking (and add some bits to the grammar because I wanted more syntax highlighting of punctuation).