diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 9e20e8a36da..49f834963ee 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -756,10 +756,7 @@ namespace FourSlash { public verifyCompletionListIsGlobal(expected: boolean) { const completions = this.getCompletionListAtCaret(); - if (!completions && expected !== undefined) { - this.raiseError(`verifyCompletionListIsGlobal failed - expected result to be ${completions}`); - } - else if (completions && completions.isGlobalCompletion !== expected) { + if (completions && completions.isGlobalCompletion !== expected) { this.raiseError(`verifyCompletionListIsGlobal failed - expected result to be ${completions.isGlobalCompletion}`); } } diff --git a/src/services/completions.ts b/src/services/completions.ts index 78756c1ac45..64ea05e4f2b 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -886,7 +886,7 @@ namespace ts.Completions { } const semanticStart = timestamp(); - let isGlobalCompletion: boolean; + let isGlobalCompletion = false; let isMemberCompletion: boolean; let isNewIdentifierLocation: boolean; let symbols: Symbol[] = []; @@ -902,7 +902,6 @@ namespace ts.Completions { else { symbols = tagSymbols; } - isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; } @@ -913,7 +912,6 @@ namespace ts.Completions { if (!typeChecker.isUnknownSymbol(tagSymbol)) { symbols = [tagSymbol]; } - isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; } diff --git a/tests/cases/fourslash/completionListIsGlobalCompletion.ts b/tests/cases/fourslash/completionListIsGlobalCompletion.ts index 58107cbcb7f..3a7adb465a1 100644 --- a/tests/cases/fourslash/completionListIsGlobalCompletion.ts +++ b/tests/cases/fourslash/completionListIsGlobalCompletion.ts @@ -23,17 +23,17 @@ goTo.marker("1"); verify.completionListIsGlobal(false); goTo.marker("2"); -verify.completionListIsGlobal(undefined); +verify.completionListIsGlobal(false); goTo.marker("3"); -verify.completionListIsGlobal(undefined); +verify.completionListIsGlobal(false); goTo.marker("4"); verify.completionListIsGlobal(true); goTo.marker("5"); -verify.completionListIsGlobal(undefined); +verify.completionListIsGlobal(false); goTo.marker("6"); verify.completionListIsGlobal(true); goTo.marker("7"); -verify.completionListIsGlobal(undefined); +verify.completionListIsGlobal(false); goTo.marker("8"); verify.completionListIsGlobal(false); goTo.marker("9");