void () { mySyntaxTable = new TextMateSyntaxTable(); CharSequence scope = null; Iterator<TextMateGrammar> grammars = TestUtil.readBundle(getBundleName()).readGrammars().iterator(); while (grammars.hasNext()) { TextMateGrammar grammar = grammars.next(); CharSequence rootScope = mySyntaxTable.loadSyntax(grammar.getPlist().getValue(), myInterner); if (rootScope != null) { grammar.getFileNameMatchers().forEach(matcher -> { myLanguageDescriptors.put(matcher, rootScope); }); if (scope == null) { scope = rootScope; } } } assertNotNull(scope); final List<String> extraBundleNames = getExtraBundleNames(); for (String bundleName : extraBundleNames) { Iterator<TextMateGrammar> extraGrammars = TestUtil.readBundle(bundleName).readGrammars().iterator(); while (extraGrammars.hasNext()) { TextMateGrammar grammar = extraGrammars.next(); mySyntaxTable.loadSyntax(grammar.getPlist().getValue(), myInterner); } } mySyntaxTable.compact(); CharSequence scopeForFileName = myLanguageDescriptors.get(new TextMateFileNameMatcher.Name(myFileName)); if (scopeForFileName != null) { myRootScope = scopeForFileName; } else { Iterator<CharSequence> extensionsIterator = TextMateEditorUtilsKt.fileNameExtensions(myFileName).iterator(); while (extensionsIterator.hasNext()) { CharSequence scopeForExtension = myLanguageDescriptors.get(new TextMateFileNameMatcher.Extension(extensionsIterator.next().toString())); if (scopeForExtension != null) { myRootScope = scopeForExtension; break; } } } assertNotNull("scope is empty for file name: " + myFileName, myRootScope); }