boolean (Editor injectedEditor, int injectedOffset) { if (injectedOffset == 0 || injectedOffset >= injectedEditor.getDocument().getTextLength()) { return false; } PsiFile injectedFile = ((EditorWindow)injectedEditor).getInjectedFile(); InjectedLanguageManager ilm = InjectedLanguageManager.getInstance(injectedFile.getProject()); TextRange rangeToEdit = new TextRange(injectedOffset - 1, injectedOffset+1); List<TextRange> editables = ilm.intersectWithAllEditableFragments(injectedFile, rangeToEdit); return editables.size() == 1 && editables.get(0).equals(rangeToEdit); }