diff --git a/src/services/completions.ts b/src/services/completions.ts index 285095e727a0c..1693185d62247 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -416,6 +416,10 @@ namespace ts.Completions { } } + if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === KeywordCompletionFilters.None) { + return undefined; + } + const entries: CompletionEntry[] = []; if (isUncheckedFile(sourceFile, compilerOptions)) { @@ -443,10 +447,6 @@ namespace ts.Completions { getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target!, entries); // TODO: GH#18217 } else { - if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === KeywordCompletionFilters.None) { - return undefined; - } - getCompletionEntriesFromSymbols( symbols, entries, diff --git a/tests/cases/fourslash/completionInUncheckedJSFile.ts b/tests/cases/fourslash/completionInUncheckedJSFile.ts index dcc3d95ed204d..1aa97c79f8d49 100644 --- a/tests/cases/fourslash/completionInUncheckedJSFile.ts +++ b/tests/cases/fourslash/completionInUncheckedJSFile.ts @@ -13,16 +13,5 @@ verify.completions({ marker: "0", - includes: [ - { - name: "hello", - sortText: completion.SortText.JavascriptIdentifiers, - isFromUncheckedFile: true - }, - { - name: "goodbye", - sortText: completion.SortText.JavascriptIdentifiers, - isFromUncheckedFile: true - } - ] + exact: undefined }); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptCompletions12.ts b/tests/cases/fourslash/getJavaScriptCompletions12.ts index 2848ee27c5462..cbbcf7fe3a6fc 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions12.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions12.ts @@ -26,5 +26,5 @@ verify.completions( { marker: "1", includes: { name: "charCodeAt", kind: "method", kindModifiers: "declare" } }, { marker: ["2", "3", "4"], includes: { name: "toExponential", kind: "method", kindModifiers: "declare" } }, - { marker: "5", includes: { name: "test1", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers } }, + { marker: "5", exact: undefined }, ); diff --git a/tests/cases/fourslash/javaScriptPrototype2.ts b/tests/cases/fourslash/javaScriptPrototype2.ts index 17afc1ed0aa4b..0020be5f16ec4 100644 --- a/tests/cases/fourslash/javaScriptPrototype2.ts +++ b/tests/cases/fourslash/javaScriptPrototype2.ts @@ -31,4 +31,4 @@ verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: goTo.marker('3'); edit.insert('.'); // Make sure symbols don't leak out into the constructor -verify.completions({ includes: ["qua", "foo", "bar"].map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })) }); +verify.completions({ exact: undefined }); diff --git a/tests/cases/fourslash/server/jsdocTypedefTag2.ts b/tests/cases/fourslash/server/jsdocTypedefTag2.ts index 601db94513045..43d5c133fa899 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTag2.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTag2.ts @@ -16,14 +16,6 @@ //// my2.yes./*1*/ //// } -//// /** -//// * @param {MyType} my2 -//// */ -//// function b(my2) { -//// my2.yes./*2*/ -//// } - verify.completions( - { marker: "1", includes: "charAt" }, - { marker: "2", excludes: "charAt" }, + { marker: "1", includes: "charAt" } );