File tree Expand file tree Collapse file tree
org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/registry Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,21 +114,22 @@ public IGrammar grammarForScopeName(
114114 @ Nullable final Map <String , Integer > embeddedLanguages ,
115115 @ Nullable final Map <String , Integer > tokenTypes ,
116116 @ Nullable final BalancedBracketSelectors balancedBracketSelectors ) {
117- if (!this ._grammars .containsKey (scopeName )) {
118- final var rawGrammar = lookup (scopeName );
117+
118+ return this ._grammars .computeIfAbsent (scopeName , scopeName_ -> {
119+ final var rawGrammar = lookup (scopeName_ );
119120 if (rawGrammar == null ) {
120121 return null ;
121122 }
122- this ._grammars .put (scopeName , new Grammar (
123- scopeName ,
123+
124+ return new Grammar (
125+ scopeName_ ,
124126 rawGrammar ,
125127 initialLanguage ,
126128 embeddedLanguages ,
127129 tokenTypes ,
128130 balancedBracketSelectors ,
129131 this ,
130- this ));
131- }
132- return this ._grammars .get (scopeName );
132+ this );
133+ });
133134 }
134135}
You can’t perform that action at this time.
0 commit comments