How to check if a PsiElement is the last element in a line

Answered

Scenes

I need to display Type Hint after `MyPsiMethod`.

I'm going to use InlayHintsSink.addInlineElement to append Inlay Hint at the end of the line.

For the following statements:


object
    .outer(call.inner())
    .method().chain();

`MyPsiMethod` has 4 in total

  • .outer(call.inner())
  • .inner()
  • .method()
  • .chain()

But I only want to generate Type Hint for .outer and .chain.

Question

How should I check if a PsiElement is the last element in a line?

The calling environment is InlayHintsCollector.collect, additional Editor context can be used.

0

Please sign in to leave a comment.