Don't boost tree-sitter grammars' score unless they match in some way

This commit is contained in:
Max Brunsfeld
2018-06-05 14:27:29 -07:00
parent 40f102919b
commit 31f511aae7
2 changed files with 11 additions and 5 deletions

View File

@@ -214,11 +214,7 @@ class GrammarRegistry {
}
if (grammar instanceof TreeSitterGrammar) {
if (this.config.get('core.useTreeSitterParsers')) {
score += 0.05
} else {
score = -Infinity
}
if (!this.config.get('core.useTreeSitterParsers')) return -Infinity
if (grammar.contentRegExp) {
if (grammar.contentRegExp.test(contents)) {
@@ -227,6 +223,8 @@ class GrammarRegistry {
score -= 0.25
}
}
if (score > 0) score += 0.05
} else if (this.grammarMatchesPrefix(grammar, contents)) {
score += 0.25
}