TextMateScope (@NotNull EditorEx editor) { TextMateScope result = getCurrentScopeFromEditor(editor); //retrieve root scope of file if (result == null) { final VirtualFile file = editor.getVirtualFile(); if (file != null) { final TextMateLanguageDescriptor languageDescriptor = TextMateService.getInstance().getLanguageDescriptorByFileName(file.getName()); if (languageDescriptor != null) { return new TextMateScope(languageDescriptor.getScopeName(), null); } } } return result; }