How to hide Hint only after text changes or scrolling?

已回答

This is my code

    int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.UPDATE_BY_SCROLLING |
                    HintManager.HIDE_IF_OUT_OF_EDITOR | HintManager.DONT_CONSUME_ESCAPE;

            HintHint hintHint = HintManagerImpl.createHintHint(editor, p, hint, HintManager.RIGHT)
                    .setAwtTooltip(false);
            HintManagerImpl.getInstanceImpl()
                    .showEditorHint(hint, editor, p, flags, 0, false, hintHint);

 

I found that when the mouse clicks on Editor, Hint will hide. I rewrote LightweightHint's vetoesHiding method to make it return true

  @Override
        public boolean vetoesHiding() {
            return true;
        }

But in this way, scrolling and text changes will not hide it

How to configure it to hide only after scrolling or text changes?

0

Please try overriding com.intellij.ui.LightweightHint#canControlAutoHide

In general, most hints should react to mouse click – why do you need to suppress it explicitly?

0

请先登录再写评论。