Dynamically display Gutter
已回答
I want to display an icon in the Gutter area when the mouse hovers over a Java method, similar to LineMarkerProvider, but what I want to do is hide it at other times.
I found a similar feature, "Toggle Rendered View", which only displays when the mouse is in the comments. How can I do this? Thank you
请先登录再写评论。
Consider the
codeInsight.lineMarkerProvider
extension point,ImplementLineMarkerProvider
interfaceexample
This is my code, although it displays the icon correctly, I cannot click on it. When I move the mouse nearby, I cannot obtain the location of PsiMethod through `PsiTreeUtil.getParentOfType`
See
com.intellij.codeInsight.documentation.render.DocRenderItemManager#setupListeners
for implementation of “Rendered Doc”I cannot understand the approach of DocRenderItemManager. Do I need to retrieve all PsiMethods from the Editor and then view the PsiMethods that match the current mouse position?
My current problem is that if the mouse and Java method definitions are in the same position,` PsiFile.findElementAt(EditMouseEvent. getOffset())` cannot retrieve PsiMethod
Unfortunately, the DocRender functionality is pretty complex and depends on a number of additional classes/functionality so it cannot be easily matched to your plugin's needs.
Unless “dynamic” gutter is absolutely required, I'd strongly suggest to just use regular gutter icons.