Need help fixing autoindent


Why is typescript not autoindenting properly. Demonstrated here :

For TypeScript : You can see that the } is moved to the right place. However the cursor end up at the start of the line. For JS both } moves to the right line and the cursor moves to the right indent level.

As far as I know it gets driven by editor.increaseIndentPattern which is the same for both TypeScript and JavaScript in my case (Since I took this setting from language-javascript):

Funny thing is that atom does indent correctly if there is some character on that line (using code editor = atom.workspace.getActiveEditor(); editor.autoIndentBufferRow(editor.getCursorBufferPosition().row)). e.g.

This there must be a character requirement is not needed for JS for some reason and I don’t see how that works (notice the indent line shows up after I run the code, it does not happen for TS if there isn’t any stuff on that line).

Any tips?

Issue Ref


Figured it out. “” needs to be classified as whitespace.


I’ve implemented a package that keeps the cursor at the current level of indentation, even on empty lines.

Feel free to try, submit issues and contribute!