Skip to content

Commit 62596ef

Browse files
authored
Send path completion item detail eagerly (microsoft#2610)
1 parent df42721 commit 62596ef

54 files changed

Lines changed: 477 additions & 318 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

internal/fourslash/_scripts/manualTests.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ completionForStringLiteralNonrelativeImport4
1212
completionForStringLiteralNonrelativeImport8
1313
completionForStringLiteralRelativeImport4
1414
completionForStringLiteralWithDynamicImport
15+
completionImportModuleSpecifierEndingDts
16+
completionImportModuleSpecifierEndingJs
17+
completionImportModuleSpecifierEndingJsx
18+
completionImportModuleSpecifierEndingTs
19+
completionImportModuleSpecifierEndingTsxPreserve
20+
completionImportModuleSpecifierEndingTsxReact
1521
completionListInClosedFunction05
1622
completionListInImportClause05
1723
completionListWithLabel
@@ -21,7 +27,12 @@ completionsImport_filteredByPackageJson_ambient
2127
completionsImport_reExportDefault
2228
completionsImport_reexportTransient
2329
completionsPaths_importType
30+
completionsPaths_kinds
31+
completionsPaths_pathMapping
2432
completionsPaths_pathMapping_nonTrailingWildcard1
33+
completionsPaths_pathMapping_parentDirectory
34+
completionsPathsJsonModule
35+
completionsPathsRelativeJsonModule
2536
completionsSelfDeclaring1
2637
completionsWithDeprecatedTag4
2738
completionsWithStringReplacementMode1
@@ -62,14 +73,43 @@ nodeModulesImportCompletions1
6273
outliningForNonCompleteInterfaceDeclaration
6374
outliningHintSpansForFunction
6475
parserCorruptionAfterMapInClass
76+
pathCompletionsPackageJsonExportsBundlerNoNodeCondition
77+
pathCompletionsPackageJsonExportsCustomConditions
6578
pathCompletionsPackageJsonExportsWildcard1
79+
pathCompletionsPackageJsonExportsWildcard10
80+
pathCompletionsPackageJsonExportsWildcard11
6681
pathCompletionsPackageJsonExportsWildcard12
82+
pathCompletionsPackageJsonExportsWildcard2
83+
pathCompletionsPackageJsonExportsWildcard3
6784
pathCompletionsPackageJsonExportsWildcard4
85+
pathCompletionsPackageJsonExportsWildcard5
86+
pathCompletionsPackageJsonExportsWildcard6
87+
pathCompletionsPackageJsonExportsWildcard7
88+
pathCompletionsPackageJsonExportsWildcard8
89+
pathCompletionsPackageJsonExportsWildcard9
90+
pathCompletionsPackageJsonImportsBundlerNoNodeCondition
91+
pathCompletionsPackageJsonImportsCustomConditions
6892
pathCompletionsPackageJsonImportsSrcNoDistWildcard1
93+
pathCompletionsPackageJsonImportsSrcNoDistWildcard2
94+
pathCompletionsPackageJsonImportsSrcNoDistWildcard3
6995
pathCompletionsPackageJsonImportsSrcNoDistWildcard4
96+
pathCompletionsPackageJsonImportsSrcNoDistWildcard5
97+
pathCompletionsPackageJsonImportsSrcNoDistWildcard6
98+
pathCompletionsPackageJsonImportsSrcNoDistWildcard7
99+
pathCompletionsPackageJsonImportsSrcNoDistWildcard8
100+
pathCompletionsPackageJsonImportsSrcNoDistWildcard9
70101
pathCompletionsPackageJsonImportsWildcard1
102+
pathCompletionsPackageJsonImportsWildcard10
103+
pathCompletionsPackageJsonImportsWildcard11
71104
pathCompletionsPackageJsonImportsWildcard12
105+
pathCompletionsPackageJsonImportsWildcard2
106+
pathCompletionsPackageJsonImportsWildcard3
72107
pathCompletionsPackageJsonImportsWildcard4
108+
pathCompletionsPackageJsonImportsWildcard5
109+
pathCompletionsPackageJsonImportsWildcard6
110+
pathCompletionsPackageJsonImportsWildcard7
111+
pathCompletionsPackageJsonImportsWildcard8
112+
pathCompletionsPackageJsonImportsWildcard9
73113
pathCompletionsTypesVersionsWildcard3
74114
pathCompletionsTypesVersionsWildcard4
75115
pathCompletionsTypesVersionsWildcard5
@@ -81,4 +121,5 @@ semicolonFormattingInsideAComment
81121
semicolonFormattingInsideAStringLiteral
82122
stringLiteralCompletionsInPositionTypedUsingRest
83123
tripleSlashRefPathCompletionAbsolutePaths
124+
tripleSlashRefPathCompletionHiddenFile
84125
tsxCompletion12

internal/fourslash/tests/gen/completionImportModuleSpecifierEndingDts_test.go renamed to internal/fourslash/tests/manual/completionImportModuleSpecifierEndingDts_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
func TestCompletionImportModuleSpecifierEndingDts(t *testing.T) {
14-
fourslash.SkipIfFailing(t)
1514
t.Parallel()
1615
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1716
const content = `//@Filename:test.d.ts
@@ -29,7 +28,8 @@ import { Test } from ".//**/"`
2928
Items: &fourslash.CompletionsExpectedItems{
3029
Includes: []fourslash.CompletionsExpectedItem{
3130
&lsproto.CompletionItem{
32-
Label: "test.js",
31+
Label: "test.js",
32+
Detail: PtrTo("test.js"),
3333
},
3434
},
3535
},
@@ -44,7 +44,8 @@ import { Test } from ".//**/"`
4444
Items: &fourslash.CompletionsExpectedItems{
4545
Includes: []fourslash.CompletionsExpectedItem{
4646
&lsproto.CompletionItem{
47-
Label: "test",
47+
Label: "test",
48+
Detail: PtrTo("test.d.ts"),
4849
},
4950
},
5051
},

internal/fourslash/tests/gen/completionImportModuleSpecifierEndingJs_test.go renamed to internal/fourslash/tests/manual/completionImportModuleSpecifierEndingJs_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
func TestCompletionImportModuleSpecifierEndingJs(t *testing.T) {
14-
fourslash.SkipIfFailing(t)
1514
t.Parallel()
1615
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1716
const content = `//@allowJs: true
@@ -32,7 +31,8 @@ import { f } from ".//**/"`
3231
Items: &fourslash.CompletionsExpectedItems{
3332
Includes: []fourslash.CompletionsExpectedItem{
3433
&lsproto.CompletionItem{
35-
Label: "test.js",
34+
Label: "test.js",
35+
Detail: PtrTo("test.js"),
3636
},
3737
},
3838
},
@@ -47,7 +47,8 @@ import { f } from ".//**/"`
4747
Items: &fourslash.CompletionsExpectedItems{
4848
Includes: []fourslash.CompletionsExpectedItem{
4949
&lsproto.CompletionItem{
50-
Label: "test",
50+
Label: "test",
51+
Detail: PtrTo("test.js"),
5152
},
5253
},
5354
},

internal/fourslash/tests/gen/completionImportModuleSpecifierEndingJsx_test.go renamed to internal/fourslash/tests/manual/completionImportModuleSpecifierEndingJsx_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
func TestCompletionImportModuleSpecifierEndingJsx(t *testing.T) {
14-
fourslash.SkipIfFailing(t)
1514
t.Parallel()
1615
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1716
const content = `//@allowJs: true
@@ -31,7 +30,8 @@ import { Test } from ".//**/"`
3130
Items: &fourslash.CompletionsExpectedItems{
3231
Includes: []fourslash.CompletionsExpectedItem{
3332
&lsproto.CompletionItem{
34-
Label: "test.jsx",
33+
Label: "test.jsx",
34+
Detail: PtrTo("test.jsx"),
3535
},
3636
},
3737
},
@@ -46,7 +46,8 @@ import { Test } from ".//**/"`
4646
Items: &fourslash.CompletionsExpectedItems{
4747
Includes: []fourslash.CompletionsExpectedItem{
4848
&lsproto.CompletionItem{
49-
Label: "test",
49+
Label: "test",
50+
Detail: PtrTo("test.jsx"),
5051
},
5152
},
5253
},

internal/fourslash/tests/gen/completionImportModuleSpecifierEndingTs_test.go renamed to internal/fourslash/tests/manual/completionImportModuleSpecifierEndingTs_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
func TestCompletionImportModuleSpecifierEndingTs(t *testing.T) {
14-
fourslash.SkipIfFailing(t)
1514
t.Parallel()
1615
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1716
const content = `//@Filename:test.ts
@@ -31,7 +30,8 @@ import { f } from ".//**/"`
3130
Items: &fourslash.CompletionsExpectedItems{
3231
Includes: []fourslash.CompletionsExpectedItem{
3332
&lsproto.CompletionItem{
34-
Label: "test.js",
33+
Label: "test.js",
34+
Detail: PtrTo("test.js"),
3535
},
3636
},
3737
},
@@ -46,7 +46,8 @@ import { f } from ".//**/"`
4646
Items: &fourslash.CompletionsExpectedItems{
4747
Includes: []fourslash.CompletionsExpectedItem{
4848
&lsproto.CompletionItem{
49-
Label: "test",
49+
Label: "test",
50+
Detail: PtrTo("test.ts"),
5051
},
5152
},
5253
},

internal/fourslash/tests/gen/completionImportModuleSpecifierEndingTsxPreserve_test.go renamed to internal/fourslash/tests/manual/completionImportModuleSpecifierEndingTsxPreserve_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
func TestCompletionImportModuleSpecifierEndingTsxPreserve(t *testing.T) {
14-
fourslash.SkipIfFailing(t)
1514
t.Parallel()
1615
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1716
const content = `//@jsx:preserve
@@ -30,7 +29,8 @@ import { Test } from ".//**/"`
3029
Items: &fourslash.CompletionsExpectedItems{
3130
Includes: []fourslash.CompletionsExpectedItem{
3231
&lsproto.CompletionItem{
33-
Label: "test.jsx",
32+
Label: "test.jsx",
33+
Detail: PtrTo("test.jsx"),
3434
},
3535
},
3636
},
@@ -45,7 +45,8 @@ import { Test } from ".//**/"`
4545
Items: &fourslash.CompletionsExpectedItems{
4646
Includes: []fourslash.CompletionsExpectedItem{
4747
&lsproto.CompletionItem{
48-
Label: "test",
48+
Label: "test",
49+
Detail: PtrTo("test.tsx"),
4950
},
5051
},
5152
},

internal/fourslash/tests/gen/completionImportModuleSpecifierEndingTsxReact_test.go renamed to internal/fourslash/tests/manual/completionImportModuleSpecifierEndingTsxReact_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
)
1212

1313
func TestCompletionImportModuleSpecifierEndingTsxReact(t *testing.T) {
14-
fourslash.SkipIfFailing(t)
1514
t.Parallel()
1615
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1716
const content = `//@jsx:react
@@ -30,7 +29,8 @@ import { Test } from ".//**/"`
3029
Items: &fourslash.CompletionsExpectedItems{
3130
Includes: []fourslash.CompletionsExpectedItem{
3231
&lsproto.CompletionItem{
33-
Label: "test.js",
32+
Label: "test.js",
33+
Detail: PtrTo("test.js"),
3434
},
3535
},
3636
},
@@ -45,7 +45,8 @@ import { Test } from ".//**/"`
4545
Items: &fourslash.CompletionsExpectedItems{
4646
Includes: []fourslash.CompletionsExpectedItem{
4747
&lsproto.CompletionItem{
48-
Label: "test",
48+
Label: "test",
49+
Detail: PtrTo("test.tsx"),
4950
},
5051
},
5152
},

internal/fourslash/tests/gen/completionsPathsJsonModule_test.go renamed to internal/fourslash/tests/manual/completionsPathsJsonModule_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
)
1111

1212
func TestCompletionsPathsJsonModule(t *testing.T) {
13-
fourslash.SkipIfFailing(t)
1413
t.Parallel()
1514
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1615
const content = `// @moduleResolution: bundler
@@ -30,8 +29,9 @@ import { } from "/**/";`
3029
Items: &fourslash.CompletionsExpectedItems{
3130
Exact: []fourslash.CompletionsExpectedItem{
3231
&lsproto.CompletionItem{
33-
Label: "test.json",
34-
Kind: PtrTo(lsproto.CompletionItemKindFile),
32+
Label: "test.json",
33+
Kind: PtrTo(lsproto.CompletionItemKindFile),
34+
Detail: PtrTo("test.json"),
3535
},
3636
},
3737
},

internal/fourslash/tests/gen/completionsPathsRelativeJsonModule_test.go renamed to internal/fourslash/tests/manual/completionsPathsRelativeJsonModule_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
)
1111

1212
func TestCompletionsPathsRelativeJsonModule(t *testing.T) {
13-
fourslash.SkipIfFailing(t)
1413
t.Parallel()
1514
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1615
const content = `// @moduleResolution: bundler
@@ -30,8 +29,9 @@ import { } from ".//**/";`
3029
Items: &fourslash.CompletionsExpectedItems{
3130
Exact: []fourslash.CompletionsExpectedItem{
3231
&lsproto.CompletionItem{
33-
Label: "test.json",
34-
Kind: PtrTo(lsproto.CompletionItemKindFile),
32+
Label: "test.json",
33+
Kind: PtrTo(lsproto.CompletionItemKindFile),
34+
Detail: PtrTo("test.json"),
3535
},
3636
},
3737
},

internal/fourslash/tests/manual/completionsPaths_importType_test.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ type B = import(".//*2*/");
3434
Items: &fourslash.CompletionsExpectedItems{
3535
Exact: []fourslash.CompletionsExpectedItem{
3636
&lsproto.CompletionItem{
37-
Label: "package",
38-
Kind: PtrTo(lsproto.CompletionItemKindFolder),
37+
Label: "package",
38+
Kind: PtrTo(lsproto.CompletionItemKindFolder),
39+
Detail: PtrTo("package"),
3940
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
4041
TextEdit: &lsproto.TextEdit{
4142
NewText: "package",
@@ -55,8 +56,9 @@ type B = import(".//*2*/");
5556
Items: &fourslash.CompletionsExpectedItems{
5657
Exact: []fourslash.CompletionsExpectedItem{
5758
&lsproto.CompletionItem{
58-
Label: "package",
59-
Kind: PtrTo(lsproto.CompletionItemKindFolder),
59+
Label: "package",
60+
Kind: PtrTo(lsproto.CompletionItemKindFolder),
61+
Detail: PtrTo("package"),
6062
},
6163
},
6264
},
@@ -70,16 +72,19 @@ type B = import(".//*2*/");
7072
Items: &fourslash.CompletionsExpectedItems{
7173
Exact: []fourslash.CompletionsExpectedItem{
7274
&lsproto.CompletionItem{
73-
Label: "node_modules",
74-
Kind: PtrTo(lsproto.CompletionItemKindFolder),
75+
Label: "node_modules",
76+
Kind: PtrTo(lsproto.CompletionItemKindFolder),
77+
Detail: PtrTo("node_modules"),
7578
},
7679
&lsproto.CompletionItem{
77-
Label: "ns",
78-
Kind: PtrTo(lsproto.CompletionItemKindFile),
80+
Label: "ns",
81+
Kind: PtrTo(lsproto.CompletionItemKindFile),
82+
Detail: PtrTo("ns.ts"),
7983
},
8084
&lsproto.CompletionItem{
81-
Label: "user",
82-
Kind: PtrTo(lsproto.CompletionItemKindFile),
85+
Label: "user",
86+
Kind: PtrTo(lsproto.CompletionItemKindFile),
87+
Detail: PtrTo("user.js"),
8388
},
8489
},
8590
},

0 commit comments

Comments
 (0)