Skip to content

Commit

Permalink
Add preview for Grammar Preference. See
Browse files Browse the repository at this point in the history
  • Loading branch information
angelozerr authored and mickaelistria committed Sep 10, 2017
1 parent f633898 commit 54be6ff
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@
public interface IGrammarRegistryManager {

/**
* Returns the {@link IGrammar} for the given content types.
* Returns the {@link IGrammar} for the given content types and null
* otherwise.
*
* @param contentTypes
* the content type.
* @return the {@link IGrammar} for the given content type.
* @return the {@link IGrammar} for the given content type and null
* otherwise.
*/
IGrammar getGrammarFor(IContentType[] contentTypes);

/**
* Returns the {@link IGrammar} for the given scope name and null otherwise.
*
* @param contentTypes
* the content type.
* @return the {@link IGrammar} for the given scope name and null otherwise.
*/
IGrammar getGrammarFor(String scopeName);

/**
* Returns the list of registered TextMate grammars.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,21 @@ public IGrammar getGrammarFor(IContentType[] contentTypes) {
for (IContentType contentType : contentTypes) {
String scopeName = getScopeName(contentType.getId());
if (scopeName != null) {
IGrammar grammar = registry.getGrammar(scopeName);
IGrammar grammar = getGrammarFor(scopeName);
if (grammar != null) {
return grammar;
}
}
}
return null;
}


@Override
public IGrammar getGrammarFor(String scopeName) {
loadGrammarsIfNeeded();
return registry.getGrammar(scopeName);
}

@Override
public IGrammarDefinition[] getDefinitions() {
loadGrammarsIfNeeded();
Expand Down
Loading

0 comments on commit 54be6ff

Please sign in to comment.