void (@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) { PsiElement container = getProcessedHint(editor); StructureViewBuilder builder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(file); if (builder instanceof TreeBasedStructureViewBuilder) { StructureViewModel model = ((TreeBasedStructureViewBuilder) builder).createStructureViewModel(editor); boolean goOneLevelUp = true; try { if (container == null) { goOneLevelUp = false; Object element = model.getCurrentEditorElement(); if (element instanceof PsiElement) { container = (PsiElement) element; } } } finally { Disposer.dispose(model); } while(true) { while(container != null && DeclarationRangeUtil.getPossibleDeclarationAtRange(container) == null) { container = container.getParent(); if (container instanceof PsiFile) return; } if (container == null || container instanceof PsiFile) { return; } if (goOneLevelUp) { goOneLevelUp = false; } else { if (!isDeclarationVisible(container, editor)) { break; } } container = container.getParent(); } } if (container == null) { return; } final TextRange range = DeclarationRangeUtil.getPossibleDeclarationAtRange(container); if (range == null) { return; } final PsiElement _container = container; ApplicationManager.getApplication().invokeLater(() -> { LightweightHint hint1 = EditorFragmentComponent.showEditorFragmentHint(editor, range, true, true); if (hint1 != null) { hint1.putUserData(CONTAINER_KEY, _container); editor.putUserData(MY_LAST_HINT_KEY, new WeakReference<>(hint1)); } }); }