Add inlay hint above method

Hello! I am developing plugin for Intellij and want to display some information above the method like it displayed near Stream operations (see attached picture for example). 
How can I do this? I have PsiMethod's reference, do I need this? Should I do this from the editor?
I found this thread: but can someone please clarify, how to use Inlay not from debug?

Comment actions Permalink


If by 'above the method' you mean between document lines (by increasing the distance between following lines' text baselines and displaying additional content between them), such possibility has been added recently (in 2018.3 EAP builds) to editor API - see Editor.getInlayModel(). InlayModel.addBlockElement(). This API is quite low-level though, you'll need also to implement some code atop of it, which will add/remove corresponding visual elements on document modifications. You can use e.g. ParameterHintsPassFactory as an inspiration.

Comment actions Permalink

To display a hint 'inside' document line, you can use a higher-level API - just implement InlayParameterHintsProvider.

Comment actions Permalink

Thanks for answer, Dmitry!


Please sign in to leave a comment.