PsiElement (@NotNull Editor editor) { WeakReference<LightweightHint> ref = editor.getUserData(MY_LAST_HINT_KEY); LightweightHint hint = SoftReference.dereference(ref); if (hint != null && hint.isVisible()){ hint.hide(); PsiElement container = hint.getUserData(CONTAINER_KEY); if (container != null && container.isValid()){ return container; } } return null; }