boolean (@NotNull Editor editor, @NotNull TextRange selectedRange) { if (editor instanceof EditorWindow editorWindow) { Editor hostEditor = editorWindow.getDelegate(); PsiFile injected = editorWindow.getInjectedFile(); TextRange hostSelectedRange = InjectedLanguageManager.getInstance(hostEditor.getProject()).injectedToHost(injected, selectedRange); return doHandleSelectionIntersection(hostEditor, hostSelectedRange); } else { return doHandleSelectionIntersection(editor, selectedRange); } }