From 1ba18314f94d691e55c34bfed68dcde1408d4912 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 6 Jul 2018 12:15:30 -0700 Subject: [PATCH] Remove grammar argument from populateInjections Co-Authored-By: Ashi Krishnan --- src/tree-sitter-language-mode.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/tree-sitter-language-mode.js b/src/tree-sitter-language-mode.js index 624124d12..014831c76 100644 --- a/src/tree-sitter-language-mode.js +++ b/src/tree-sitter-language-mode.js @@ -459,12 +459,12 @@ class LanguageLayer { if (!grammar.injectionRegExp) return if (!this.currentParsePromise) this.currentParsePromise = Promise.resolve() this.currentParsePromise = this.currentParsePromise.then(async () => { - await this._populateInjections(MAX_RANGE, grammar) + await this._populateInjections(MAX_RANGE) const markers = this.languageMode.injectionsMarkerLayer.getMarkers().filter(marker => marker.parentLanguageLayer === this ) for (const marker of markers) { - await marker.languageLayer._populateInjections(MAX_RANGE, grammar) + await marker.languageLayer._populateInjections(MAX_RANGE) } this.currentParsePromise = null }) @@ -512,7 +512,7 @@ class LanguageLayer { await this._populateInjections(affectedRange) } - async _populateInjections (range, newGrammar = null) { + async _populateInjections (range) { const {injectionsMarkerLayer, grammarForLanguageString} = this.languageMode const existingInjectionMarkers = injectionsMarkerLayer @@ -540,7 +540,6 @@ class LanguageLayer { const grammar = grammarForLanguageString(languageName) if (!grammar) continue - if (newGrammar && grammar !== newGrammar) continue const contentNodes = injectionPoint.content(node) if (!contentNodes) continue