Hello. I am wondering how I would go about implementing an auto block-closing feature, similar to when you press enter after opening a curly brace, but with keywords instead.
If I start a line with function hello() and then press enter, I would like the resulting code to be:
// Caret indented
The main questions are:
- How can I get the text / PsiElement of the current line in my EnterHandlerDelegate so I can check how it should be closed?
- How can I force an indent when I press enter?
- How can I add text after the newline? I have found file.add(psiElement), but I'm not sure how to create the element.