Skip to content

Commit 33829fa

Browse files
committed
Fix and updated tests
1 parent 7139f37 commit 33829fa

File tree

5 files changed

+8
-27
lines changed

5 files changed

+8
-27
lines changed

src/services/completions.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ namespace ts.Completions {
416416
}
417417
}
418418

419+
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === KeywordCompletionFilters.None) {
420+
return undefined;
421+
}
422+
419423
const entries: CompletionEntry[] = [];
420424

421425
if (isUncheckedFile(sourceFile, compilerOptions)) {
@@ -443,10 +447,6 @@ namespace ts.Completions {
443447
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target!, entries); // TODO: GH#18217
444448
}
445449
else {
446-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === KeywordCompletionFilters.None) {
447-
return undefined;
448-
}
449-
450450
getCompletionEntriesFromSymbols(
451451
symbols,
452452
entries,

tests/cases/fourslash/completionInUncheckedJSFile.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,5 @@
1313

1414
verify.completions({
1515
marker: "0",
16-
includes: [
17-
{
18-
name: "hello",
19-
sortText: completion.SortText.JavascriptIdentifiers,
20-
isFromUncheckedFile: true
21-
},
22-
{
23-
name: "goodbye",
24-
sortText: completion.SortText.JavascriptIdentifiers,
25-
isFromUncheckedFile: true
26-
}
27-
]
16+
exact: undefined
2817
});

tests/cases/fourslash/getJavaScriptCompletions12.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
verify.completions(
2727
{ marker: "1", includes: { name: "charCodeAt", kind: "method", kindModifiers: "declare" } },
2828
{ marker: ["2", "3", "4"], includes: { name: "toExponential", kind: "method", kindModifiers: "declare" } },
29-
{ marker: "5", includes: { name: "test1", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers } },
29+
{ marker: "5", exact: undefined },
3030
);

tests/cases/fourslash/javaScriptPrototype2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers:
3131
goTo.marker('3');
3232
edit.insert('.');
3333
// Make sure symbols don't leak out into the constructor
34-
verify.completions({ includes: ["qua", "foo", "bar"].map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })) });
34+
verify.completions({ exact: undefined });

tests/cases/fourslash/server/jsdocTypedefTag2.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
//// my2.yes./*1*/
1717
//// }
1818

19-
//// /**
20-
//// * @param {MyType} my2
21-
//// */
22-
//// function b(my2) {
23-
//// my2.yes./*2*/
24-
//// }
25-
2619
verify.completions(
27-
{ marker: "1", includes: "charAt" },
28-
{ marker: "2", excludes: "charAt" },
20+
{ marker: "1", includes: "charAt" }
2921
);

0 commit comments

Comments
 (0)