From 653a66619ab0418253eb47b07465f57647e99c2c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 6 Jul 2018 15:31:33 -0700 Subject: [PATCH] Fix error when injection points are added before grammars are loaded --- src/grammar-registry.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 1eeb36461..101a38007 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -291,8 +291,9 @@ class GrammarRegistry { forEachGrammar (callback) { this.textmateRegistry.grammars.forEach(callback) - for (let grammarId in this.treeSitterGrammarsById) { - callback(this.treeSitterGrammarsById[grammarId]) + for (const grammarId in this.treeSitterGrammarsById) { + const grammar = this.treeSitterGrammarsById[grammarId] + if (grammar.id) callback(grammar) } }