what is the correct way to implement indent after "enter"
已回答
I'm trying to add an indent in my simple "if block" that looks exactly like in java. I tried with formatters, which doesn't seem to be the way to go. Now i'm trying with enter processors and handlers/delegates, but no luck still, they don't seem to trigger at all. Is there an example or documentation on how to do it?
请先登录再写评论。
the last thing I tried was to extend "EnterBetweenBracesDelegate" and override "formatAtOffset" where I tried to append white spaces " " and move caret. It did append the white spaces but didn't move the caret.
Any way, what I'm trying doesn't sound right. But over the years, many people asked the same question as me, and I didn't see any useful answer. Seems like everyone is trying just about anything, eventually they get it working in probably sub-optimal way. Some documentation on this would be useful.
Same issue here, I have a formatter working fine, but I can't get the smart indent on enter working. I asked for an advice in Slack, see https://jetbrains-platform.slack.com/archives/C5U8BM1MK/p1610744329019200
Sorry for delay. Please try using extension point com.intellij.psi.codeStyle.lineIndent.LineIndentProvider which is Document-based (do not commit Document or use PSI), see https://plugins.jetbrains.com/intellij-platform-explorer/?extensions=com.intellij.lineIndentProvider for sample code.