API for indenting


I want to fix this issue: http://youtrack.jetbrains.com/issue/HAXE-354 as it seems it's not going to be fixed in the near future, and I think it's very annoying.

I've been taking a look at the code but I cannot seem to find the place where this needs to be fixed. What I need to know is the API IDEA uses when pressing the enter key and adding the spaces/tabs to a new line. Pasting code works correctly though.

I found some Indenting code, but the Whitespace PSI already contains the spaces/tabs when that class is called.


Hi Edu,

I think the API you want is Block.getChildAttributes().



Hi Colin.

Sorry for the delay. You were right, this was the call, although I don't understand why, because before this gets called, there are other places that get hit with different whitespace already (when debugging the PsiWhitespace object, I see that a tab has been added for example, although I need to add two). Anyway, modifying this call makes everything work :).

Just by any chance, do you know the place where spacing is added when you press enter in the middle of existing text? It doesn't seems to be the same.

Even if you don't, thank you very much :)


No problem, glad it helped!

I'm not sure what you mean by "where spacing is added when you press enter in the middle of existing text" - how is that different from the original problem?


I thought it was, but that part is not called if you have ('|' being the cursor):

public vo|id

...and pressing enter. It gets only called when you create a new empty line.


Hmm, in that case I'm not sure, sorry - it's a while since I looked at that code.


Please sign in to leave a comment.