forked from microsoft/TypeScript
/
importStatementCompletions1.ts
101 lines (80 loc) · 1.97 KB
/
importStatementCompletions1.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/// <reference path="fourslash.ts" />
// @Filename: /mod.ts
//// export const foo = 0;
// @Filename: /index0.ts
//// [|import f/*0*/|]
// @Filename: /index1.ts
//// [|import { f/*1*/}|]
// @Filename: /index2.ts
//// [|import * as f/*2*/|]
// @Filename: /index3.ts
//// [|import f/*3*/ from|]
// @Filename: /index4.ts
//// [|import f/*4*/ =|]
// @Filename: /index5.ts
//// import f/*5*/ from "";
[0, 1, 2, 3, 4, 5].forEach(marker => {
verify.completions({
marker: "" + marker,
exact: [{
name: "foo",
source: "./mod",
insertText: `import { foo$1 } from "./mod";`,
isSnippet: true,
replacementSpan: test.ranges()[marker],
sourceDisplay: "./mod",
}],
preferences: {
includeCompletionsForImportStatements: true,
includeInsertTextCompletions: true,
includeCompletionsWithSnippetText: true,
}
});
});
// @Filename: /index6.ts
//// import f/*6*/ from "nope";
// @Filename: /index7.ts
//// import { f/*7*/, bar }
// @Filename: /index8.ts
//// import foo, { f/*8*/ }
// @Filename: /index9.ts
//// import g/*9*/
// @Filename: /index10.ts
//// import f/*10*/ from "./mod";
// @Filename: /index11.ts
//// import oo/*11*/
// @Filename: /index12.ts
//// import {
//// /*12*/
//// }
[6, 7, 8, 9, 10, 11, 12].forEach(marker => {
verify.completions({
marker: "" + marker,
exact: [],
preferences: {
includeCompletionsForImportStatements: true,
includeInsertTextCompletions: true,
}
});
});
// @Filename: /index13.ts
//// import {} /*13*/
// @Filename: /index14.ts
//// import {} f/*14*/
// @Filename: /index15.ts
//// import * as foo /*15*/
// @Filename: /index16.ts
//// import * as foo f/*16*/
[13, 14, 15, 16].forEach(marker => {
verify.completions({
marker: "" + marker,
exact: {
name: "from",
sortText: completion.SortText.GlobalsOrKeywords,
},
preferences: {
includeCompletionsForImportStatements: true,
includeInsertTextCompletions: true,
}
});
});