Skip to content

Commit e1a2b9e

Browse files
committed
Revert "Fix and updated tests"
This reverts commit 33829fa.
1 parent 2249d6c commit e1a2b9e

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

src/services/completions.ts

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

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

425421
if (isUncheckedFile(sourceFile, compilerOptions)) {
@@ -447,6 +443,10 @@ namespace ts.Completions {
447443
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target!, entries); // TODO: GH#18217
448444
}
449445
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

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

1414
verify.completions({
1515
marker: "0",
16-
exact: undefined
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+
]
1728
});

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", exact: undefined },
29+
{ marker: "5", includes: { name: "test1", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers } },
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({ exact: undefined });
34+
verify.completions({ includes: ["qua", "foo", "bar"].map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })) });

tests/cases/fourslash/server/jsdocTypedefTag2.ts

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

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

0 commit comments

Comments
 (0)