Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dc73483
Parse type-only import specifiers
andrewbranch Sep 16, 2021
ad27364
Add type-only export specifiers
andrewbranch Sep 16, 2021
0ba00b9
Update transform and emit
andrewbranch Sep 16, 2021
eb63b02
Update checking
andrewbranch Sep 16, 2021
9b31bd1
Fix elision when combined with importsNotUsedAsValues=preserve
andrewbranch Sep 16, 2021
02d4ff9
Accept baselines
andrewbranch Sep 17, 2021
ac9b14b
Add test
andrewbranch Sep 20, 2021
577868d
WIP auto imports updates
andrewbranch Sep 20, 2021
c41f8ee
First auto-imports test working
andrewbranch Sep 20, 2021
d34544c
More auto-import tests
andrewbranch Sep 20, 2021
76da8c7
Fix auto imports of type-only exports
andrewbranch Sep 21, 2021
487f585
Add test for promoting type-only import
andrewbranch Sep 21, 2021
b6ea3ac
Sort import/export specifiers by type-onlyness
andrewbranch Sep 21, 2021
9a1765e
Update completions for `import { type |`
andrewbranch Sep 22, 2021
9e1878d
Update other completions tests
andrewbranch Sep 22, 2021
f7248e1
Respect organize imports sorting when promoting type-only to regular …
andrewbranch Sep 22, 2021
06063f2
Fix comment mistakes
andrewbranch Sep 24, 2021
4ba367b
Update src/services/codefixes/importFixes.ts
andrewbranch Sep 24, 2021
75a2909
Rearrange some order of assignments in parser
andrewbranch Sep 24, 2021
b55acde
Split huge if statement
andrewbranch Sep 24, 2021
414f38b
Remove redundant check
andrewbranch Sep 24, 2021
3768d0a
Merge branch 'main' into feature/type-only-specifiers
andrewbranch Sep 24, 2021
39e72d8
Update new transformer
andrewbranch Sep 24, 2021
9033c72
Fix import statement completions
andrewbranch Sep 24, 2021
adcb331
Fix type keyword completions good grief
andrewbranch Sep 27, 2021
d64c923
Fix last tests
andrewbranch Sep 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update other completions tests
  • Loading branch information
andrewbranch committed Sep 22, 2021
commit 9e1878d6d6740430f75a2479d5b1cc84e454cce5
16 changes: 14 additions & 2 deletions tests/cases/fourslash/completionInNamedImportLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@

goTo.file("a.ts");
verify.completions(
{ marker: "1", exact: [{ name: "x", text: "var x: number" }, { name: "y", text: "var y: number" }] },
{ marker: "2", exact: [{ name: "y", text: "var y: number" }] },
{
marker: "1",
exact: [
{ name: "x", text: "var x: number" },
{ name: "y", text: "var y: number" },
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords }
]
},
{
marker: "2",
exact: [
{ name: "y", text: "var y: number" },
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords }
] },
);
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionListForExportEquals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
// @Filename: /a.ts
////import { /**/ } from "foo";

verify.completions({ marker: "", exact: ["Static", "foo"] });
verify.completions({ marker: "", exact: ["Static", "foo", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }] });
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionListForExportEquals2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
// @Filename: /a.ts
////import { /**/ } from "foo";

verify.completions({ marker: "", exact: "Static" });
verify.completions({ marker: "", exact: ["Static", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }] });
8 changes: 5 additions & 3 deletions tests/cases/fourslash/completionListInExportClause01.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
////export {bar as /*5*/, /*6*/ from "./m1"
////export {foo, bar, baz as b,/*7*/} from "./m1"

const type = { name: "type", sortText: completion.SortText.GlobalsOrKeywords };

verify.completions(
{ marker: ["1", "2", "3"], exact: ["bar", "baz", "foo"] },
{ marker: "4", exact: ["bar", "baz"] },
{ marker: ["1", "2", "3"], exact: ["bar", "baz", "foo", type] },
{ marker: "4", exact: ["bar", "baz", type] },
{ marker: "5", exact: undefined, isNewIdentifierLocation: true },
{ marker: "6", exact: ["baz", "foo"] },
{ marker: "6", exact: ["baz", "foo", type] },
{ marker: "7", exact: undefined },
);
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionListInExportClause02.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
//// export { /**/ } from "M1"
////}

verify.completions({ marker: "", exact: "V" });
verify.completions({ marker: "", exact: ["V", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }] });
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionListInExportClause03.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
////}

// Ensure we don't filter out the current item.
verify.completions({ marker: "", exact: ["abc", "def"] });
verify.completions({ marker: "", exact: ["abc", "def", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }] });
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionListInImportClause02.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
//// import { /**/ } from "M1"
////}

verify.completions({ marker: "", exact: "V" });
verify.completions({ marker: "", exact: ["V", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }] });
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionListInImportClause03.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
////}

// Ensure we don't filter out the current item.
verify.completions({ marker: "", exact: ["abc", "def"] });
verify.completions({ marker: "", exact: ["abc", "def", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }] });
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionListInImportClause04.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// @Filename: app.ts
////import {/*1*/} from './foo';

verify.completions({ marker: "1", exact: ["prototype", "prop1", "prop2"] });
verify.completions({ marker: "1", exact: ["prototype", "prop1", "prop2", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }] });
verify.noErrors();
goTo.marker('2');
verify.noErrors();
11 changes: 7 additions & 4 deletions tests/cases/fourslash/completionsInExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
////type T = number;
////export { /**/ };

const type = { name: "type", sortText: completion.SortText.GlobalsOrKeywords }

verify.completions({
marker: "",
exact: ["a", "T"]
exact: ["a", "T", type]
});

// Deprioritize 'a' since it has been exported already.
// (Keep it in the list because you can still do 'a as b'.)
edit.insert("a, ");
verify.completions({
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T"]
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T", type]
});

// No completions for new name
Expand All @@ -25,14 +27,15 @@ verify.completions({
// 'T' still hasn't been exported by name
edit.insert("U, ");
verify.completions({
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T"]
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T", type]
});

// 'a' and 'T' are back to the same priority
edit.insert("T, ");
verify.completions({
exact: [
{ name: "a", sortText: completion.SortText.OptionalMember },
{ name: "T", sortText: completion.SortText.OptionalMember }
{ name: "T", sortText: completion.SortText.OptionalMember },
type,
]
});
2 changes: 1 addition & 1 deletion tests/cases/fourslash/completionsInExport_invalid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

verify.completions({
marker: "",
exact: ["topLevel"]
exact: ["topLevel", { name: "type", sortText: completion.SortText.GlobalsOrKeywords }]
});
11 changes: 7 additions & 4 deletions tests/cases/fourslash/completionsInExport_moduleBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
//// export { /**/ };
////}

const type = { name: "type", sortText: completion.SortText.GlobalsOrKeywords };

verify.completions({
marker: "",
exact: ["a", "T"]
exact: ["a", "T", type]
});

// Deprioritize 'a' since it has been exported already.
// (Keep it in the list because you can still do 'a as b'.)
edit.insert("a, ");
verify.completions({
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T"]
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T", type]
});

// No completions for new name
Expand All @@ -29,14 +31,15 @@ verify.completions({
// 'T' still hasn't been exported by name
edit.insert("U, ");
verify.completions({
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T"]
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T", type]
});

// 'a' and 'T' are back to the same priority
edit.insert("T, ");
verify.completions({
exact: [
{ name: "a", sortText: completion.SortText.OptionalMember },
{ name: "T", sortText: completion.SortText.OptionalMember }
{ name: "T", sortText: completion.SortText.OptionalMember },
type,
]
});