Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Update Tree-sitter syntax highlighting synchronously for parses that complete sync #17923

Merged
merged 8 commits into from
Aug 24, 2018
Prev Previous commit
Next Next commit
Allow replacing editor's grammar with a grammar with the same scope name
  • Loading branch information
maxbrunsfeld committed Aug 24, 2018
commit f716a73b5944996c24e005ec165e7bbd46b93bdc
4 changes: 2 additions & 2 deletions src/grammar-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class GrammarRegistry {
}

this.grammarScoresByBuffer.set(buffer, null)
if (grammar.scopeName !== buffer.getLanguageMode().getLanguageId()) {
if (grammar !== buffer.getLanguageMode().grammar) {
buffer.setLanguageMode(this.languageModeForGrammarAndBuffer(grammar, buffer))
}

Expand All @@ -161,7 +161,7 @@ class GrammarRegistry {
)
this.languageOverridesByBufferId.delete(buffer.id)
this.grammarScoresByBuffer.set(buffer, result.score)
if (result.grammar.scopeName !== buffer.getLanguageMode().getLanguageId()) {
if (result.grammar !== buffer.getLanguageMode().grammar) {
buffer.setLanguageMode(this.languageModeForGrammarAndBuffer(result.grammar, buffer))
}
}
Expand Down