I'm developing a custom language provider and struggling with the way IJ identifies the expression at the caret. When the caret is at the beginning or in the middle of a psi-element for which help is requested everything is working well:
However, when the caret is at the end it does NOT pull up any help:
What happens internally is that com.intellij.lang.documentation.DocumentationProviderEx#generateDoc is called with the next psi-sibling (in this case the new-line) instead.
In the java language integration this does not happen, and also identifier-final carets result in the correct help popup. Is there an easy way (e.g. some psi-utility method) to achieve a similar behavior for custom languages?
So in other words my issue is not so much related to DocumentationProvider but rather to the question about how to identify the psi-element under the caret when the caret is at its end.