I'm trying to implement a Scheme mode for IntelliJ, and I have something basic working based on the Clojure plugin. When building blocks for formatting lists, I'd like to make it align all blocks under the last element on the current line. However I can't find a way to be able to tell which line a particular PsiElement is on. Is there a way to do this?
Following the Clojure example, I've managed to consistently line up under an element with a constant index (the 2nd or 3rd, for example), but I can't get quite the effect I want. I'd like to get the following layouts:
(a b c
But to achieve this each element has to have knowledge of whether it's currently on the same line as the previous element. Can I achieve this?