Adding additional content inside the editor window
Answered
I've seen some plugins that add additional elements inside the editor window like panels and buttons, where some code is rendered, the panel is rendered, and then the code continues. I can't find any references on how to do this, or what it's called?
Please sign in to leave a comment.
Hi Evan,
Please clarify what you mean. A screenshot will be great.
Hey,
The BitBucket Pull Requests plugin does a similar panel:
Hi Evan,
Take a look at Inlay API: https://plugins.jetbrains.com/docs/intellij/inlay-hints.html#advanced-inlay-hints
I also suggest using UI Inspector to check how specific inlays are implemented: https://plugins.jetbrains.com/docs/intellij/internal-ui-inspector.html
Thanks, I'll have a look.
The docs recommend using the provider from the `declarative` package - are there any docs for that one, or samples?
Unfortunately, there is no documented example (we will update the docs to cover the new interface). I suggest checking the existing implementations in the platform sources, e.g.:
https://github.com/JetBrains/intellij-community/blob/master/java/java-impl/src/com/intellij/codeInsight/hints/JavaMethodChainsDeclarativeInlayProvider.kt
Also, you can search for "declarativeInlayProvider" on IntelliJ Platform Explorer: https://jb.gg/ipe.
Could you give a sample of how to add a block element? The older syntax had sink.addBlockElement, but the new one just has addPresentation and the InlayPosition only seems to have end of line and inline, it's not clear how to make a new one.
Hi Evan,
I’m sorry for the delayed reply. I’ve got information that declarative
InlayHintsProvider
doesn’t and most likely will not support block inlays.The alternative for block inlays is
com.intellij.codeInsight.hints.codeVision.DaemonBoundCodeVisionProvider
orcom.intellij.codeInsight.codeVision.CodeVisionProvider
. It is not documented yet, so please check the existing implementations in the intelli-community source code or on IntelliJ Platform Explorer.Thanks, I'll have a look.