From e6454e6cbcb4be773c4944243758569d4fb4f069 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 2 Oct 2018 11:36:32 -0700 Subject: [PATCH] Add workaround some completions unit tests failing with null access exceptions --- src/vs/editor/contrib/suggest/completionModel.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/contrib/suggest/completionModel.ts b/src/vs/editor/contrib/suggest/completionModel.ts index 99812449f0b..335db966ce6 100644 --- a/src/vs/editor/contrib/suggest/completionModel.ts +++ b/src/vs/editor/contrib/suggest/completionModel.ts @@ -222,16 +222,16 @@ export class CompletionModel { // if it matches we check with the label to compute highlights // and if that doesn't yield a result we have no highlights, // despite having the match - let match = scoreFn(word, wordLow, wordPos, suggestion.filterText, suggestion._filterTextLow, 0, false); + let match = scoreFn(word, wordLow, wordPos, suggestion.filterText, typeof suggestion._filterTextLow === 'undefined' && suggestion.filterText ? suggestion.filterText.toLowerCase() : suggestion._filterTextLow, 0, false); if (!match) { continue; } item.score = match[0]; - item.matches = (fuzzyScore(word, wordLow, 0, suggestion.label, suggestion._labelLow, 0, true) || anyScore(word, suggestion.label))[1]; + item.matches = (fuzzyScore(word, wordLow, 0, suggestion.label, typeof suggestion._labelLow === 'undefined' ? suggestion.label.toLowerCase() : suggestion._labelLow, 0, true) || anyScore(word, suggestion.label))[1]; } else { // by default match `word` against the `label` - let match = scoreFn(word, wordLow, wordPos, suggestion.label, suggestion._labelLow, 0, false); + let match = scoreFn(word, wordLow, wordPos, suggestion.label, typeof suggestion._labelLow === 'undefined' ? suggestion.label.toLowerCase() : suggestion._labelLow, 0, false); if (match) { item.score = match[0]; item.matches = match[1]; -- GitLab