How to add indent after round bracket+newline when typing and reformatting? Follow
Hey there,
it's been a while since I've worked on a formatter for R. See https://github.com/holgerbrandl/r4intellij/tree/master/src/com/r4intellij/editor/formatting. In general, it's doing its job, except for one feature, which is to add an indent after a round bracket followed by a line break:
foo = function(){
paste(
"bla",
"bla",
"bla"
)
}
In the example, all the "bla"s should be indented. What would be the correct function in https://github.com/holgerbrandl/r4intellij/blob/master/src/com/r4intellij/editor/formatting/RIndentProcessor.java to implement such a formatting logic?
2. Not sure if the same API after under the hood, but I'd also mimic the feature of other language integrations (kotlin, java) to indent on pressing enter after an opening round bracket. paste(<enter> <-- should break line and indent. Is the done by the formatter as well, or this is a different API?
Thanks & best regards,
Holger
Please sign in to leave a comment.
I think (!) the code you should have a close look at is in
Specifically, pay attention to the end of this method which seems to handle this