vscode-apollo 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/.vscode/launch.json +5 -1
  3. package/CHANGELOG.md +41 -0
  4. package/package.json +9 -4
  5. package/renovate.json +2 -1
  6. package/sampleWorkspace/localSchema/src/test.js +3 -0
  7. package/sampleWorkspace/rover/apollo.config.js +3 -0
  8. package/sampleWorkspace/rover/src/test.graphql +14 -0
  9. package/sampleWorkspace/rover/src/test.js +30 -0
  10. package/sampleWorkspace/sampleWorkspace.code-workspace +25 -19
  11. package/src/language-server/__tests__/document.test.ts +161 -3
  12. package/src/language-server/__tests__/fixtures/TypeScript.tmLanguage.json +5749 -0
  13. package/src/language-server/__tests__/fixtures/documents/commentWithTemplate.ts +41 -0
  14. package/src/language-server/__tests__/fixtures/documents/commentWithTemplate.ts.snap +185 -0
  15. package/src/language-server/__tests__/fixtures/documents/functionCall.ts +93 -0
  16. package/src/language-server/__tests__/fixtures/documents/functionCall.ts.snap +431 -0
  17. package/src/language-server/__tests__/fixtures/documents/taggedTemplate.ts +80 -0
  18. package/src/language-server/__tests__/fixtures/documents/taggedTemplate.ts.snap +353 -0
  19. package/src/language-server/__tests__/fixtures/documents/templateWithComment.ts +38 -0
  20. package/src/language-server/__tests__/fixtures/documents/templateWithComment.ts.snap +123 -0
  21. package/src/language-server/config/__tests__/loadConfig.ts +28 -16
  22. package/src/language-server/config/config.ts +50 -12
  23. package/src/language-server/config/loadConfig.ts +2 -1
  24. package/src/language-server/config/which.d.ts +19 -0
  25. package/src/language-server/document.ts +86 -53
  26. package/src/language-server/fileSet.ts +8 -6
  27. package/src/language-server/project/base.ts +64 -315
  28. package/src/language-server/project/client.ts +731 -21
  29. package/src/language-server/project/internal.ts +354 -0
  30. package/src/language-server/project/rover/DocumentSynchronization.ts +385 -0
  31. package/src/language-server/project/rover/__tests__/DocumentSynchronization.test.ts +302 -0
  32. package/src/language-server/project/rover/project.ts +341 -0
  33. package/src/language-server/server.ts +187 -98
  34. package/src/language-server/utilities/__tests__/source.test.ts +162 -0
  35. package/src/language-server/utilities/languageIdForExtension.ts +39 -0
  36. package/src/language-server/utilities/source.ts +38 -3
  37. package/src/language-server/workspace.ts +61 -12
  38. package/src/languageServerClient.ts +13 -15
  39. package/src/tools/utilities/getLanguageInformation.ts +41 -0
  40. package/src/tools/utilities/languageInformation.ts +41 -0
  41. package/syntaxes/graphql.js.json +18 -21
  42. package/src/language-server/languageProvider.ts +0 -795
@@ -0,0 +1,353 @@
1
+ >// hint for reading the snapshots generated by this file:
2
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
3
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
4
+ >// it is important to check that a rule doesn't only enter `meta.embedded.block.graphql`
5
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
6
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
7
+ >// but also leaves it again
8
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
9
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
10
+ >
11
+ >declare function gql<A = any, B = any>(strings: TemplateStringsArray): void;
12
+ #^^^^^^^ source.ts meta.function.ts storage.modifier.ts
13
+ # ^ source.ts meta.function.ts
14
+ # ^^^^^^^^ source.ts meta.function.ts storage.type.function.ts
15
+ # ^ source.ts meta.function.ts
16
+ # ^^^ source.ts meta.function.ts meta.definition.function.ts entity.name.function.ts
17
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
18
+ # ^ source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts
19
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
20
+ # ^ source.ts meta.function.ts meta.type.parameters.ts keyword.operator.assignment.ts
21
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
22
+ # ^^^ source.ts meta.function.ts meta.type.parameters.ts support.type.primitive.ts
23
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.separator.comma.ts
24
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
25
+ # ^ source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts
26
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
27
+ # ^ source.ts meta.function.ts meta.type.parameters.ts keyword.operator.assignment.ts
28
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
29
+ # ^^^ source.ts meta.function.ts meta.type.parameters.ts support.type.primitive.ts
30
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
31
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
32
+ # ^^^^^^^ source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
33
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
34
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
35
+ # ^^^^^^^^^^^^^^^^^^^^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts entity.name.type.ts
36
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
37
+ # ^ source.ts meta.function.ts meta.return.type.ts keyword.operator.type.annotation.ts
38
+ # ^ source.ts meta.function.ts meta.return.type.ts
39
+ # ^^^^ source.ts meta.function.ts meta.return.type.ts support.type.primitive.ts
40
+ # ^ source.ts punctuation.terminator.statement.ts
41
+ >declare function foo<A = any, B = any>(strings: TemplateStringsArray): void;
42
+ #^^^^^^^ source.ts meta.function.ts storage.modifier.ts
43
+ # ^ source.ts meta.function.ts
44
+ # ^^^^^^^^ source.ts meta.function.ts storage.type.function.ts
45
+ # ^ source.ts meta.function.ts
46
+ # ^^^ source.ts meta.function.ts meta.definition.function.ts entity.name.function.ts
47
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
48
+ # ^ source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts
49
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
50
+ # ^ source.ts meta.function.ts meta.type.parameters.ts keyword.operator.assignment.ts
51
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
52
+ # ^^^ source.ts meta.function.ts meta.type.parameters.ts support.type.primitive.ts
53
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.separator.comma.ts
54
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
55
+ # ^ source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts
56
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
57
+ # ^ source.ts meta.function.ts meta.type.parameters.ts keyword.operator.assignment.ts
58
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
59
+ # ^^^ source.ts meta.function.ts meta.type.parameters.ts support.type.primitive.ts
60
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
61
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
62
+ # ^^^^^^^ source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
63
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
64
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
65
+ # ^^^^^^^^^^^^^^^^^^^^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts entity.name.type.ts
66
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
67
+ # ^ source.ts meta.function.ts meta.return.type.ts keyword.operator.type.annotation.ts
68
+ # ^ source.ts meta.function.ts meta.return.type.ts
69
+ # ^^^^ source.ts meta.function.ts meta.return.type.ts support.type.primitive.ts
70
+ # ^ source.ts punctuation.terminator.statement.ts
71
+ >declare type SomeResult = any;
72
+ #^^^^^^^ source.ts meta.type.declaration.ts storage.modifier.ts
73
+ # ^ source.ts meta.type.declaration.ts
74
+ # ^^^^ source.ts meta.type.declaration.ts storage.type.type.ts
75
+ # ^ source.ts meta.type.declaration.ts
76
+ # ^^^^^^^^^^ source.ts meta.type.declaration.ts entity.name.type.alias.ts
77
+ # ^ source.ts meta.type.declaration.ts
78
+ # ^ source.ts meta.type.declaration.ts keyword.operator.assignment.ts
79
+ # ^ source.ts meta.type.declaration.ts
80
+ # ^^^ source.ts meta.type.declaration.ts support.type.primitive.ts
81
+ # ^ source.ts punctuation.terminator.statement.ts
82
+ >declare type SomeVariables = any;
83
+ #^^^^^^^ source.ts meta.type.declaration.ts storage.modifier.ts
84
+ # ^ source.ts meta.type.declaration.ts
85
+ # ^^^^ source.ts meta.type.declaration.ts storage.type.type.ts
86
+ # ^ source.ts meta.type.declaration.ts
87
+ # ^^^^^^^^^^^^^ source.ts meta.type.declaration.ts entity.name.type.alias.ts
88
+ # ^ source.ts meta.type.declaration.ts
89
+ # ^ source.ts meta.type.declaration.ts keyword.operator.assignment.ts
90
+ # ^ source.ts meta.type.declaration.ts
91
+ # ^^^ source.ts meta.type.declaration.ts support.type.primitive.ts
92
+ # ^ source.ts punctuation.terminator.statement.ts
93
+ >
94
+ >// for comparison - this is what a normal function all is colored
95
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
96
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
97
+ >foo`query Foo { test }`;
98
+ #^^^ source.ts entity.name.function.tagged-template.ts
99
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
100
+ # ^^^^^^^^^^^^^^^^^^ source.ts string.template.ts
101
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
102
+ # ^ source.ts punctuation.terminator.statement.ts
103
+ >foo<SomeResult, SomeVariables>`query Foo { test }`;
104
+ #^^^ source.ts entity.name.function.tagged-template.ts
105
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
106
+ # ^^^^^^^^^^ source.ts meta.type.parameters.ts entity.name.type.ts
107
+ # ^ source.ts meta.type.parameters.ts punctuation.separator.comma.ts
108
+ # ^ source.ts meta.type.parameters.ts
109
+ # ^^^^^^^^^^^^^ source.ts meta.type.parameters.ts entity.name.type.ts
110
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
111
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
112
+ # ^^^^^^^^^^^^^^^^^^ source.ts string.template.ts
113
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
114
+ # ^ source.ts punctuation.terminator.statement.ts
115
+ >
116
+ >// prettier-ignore
117
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
118
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
119
+ >gql`query Q1 { test }`
120
+ #^^^^ source.ts
121
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
122
+ # ^ source.ts meta.embedded.block.graphql
123
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
124
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
125
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
126
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
127
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
128
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
129
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
130
+ # ^ source.ts
131
+ >
132
+ >// prettier-ignore
133
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
134
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
135
+ >gql<SomeResult, SomeVariables>`query Q2 { test }`
136
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts
137
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
138
+ # ^ source.ts meta.embedded.block.graphql
139
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
140
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
141
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
142
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
143
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
144
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
145
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
146
+ # ^ source.ts
147
+ >
148
+ >// prettier-ignore
149
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
150
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
151
+ >gql <SomeResult, SomeVariables> `
152
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts
153
+ >query Q3 { test }`
154
+ #^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
155
+ # ^ source.ts meta.embedded.block.graphql
156
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
157
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
158
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
159
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
160
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
161
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
162
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
163
+ # ^ source.ts
164
+ >
165
+ >// prettier-ignore
166
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
167
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
168
+ >gql `query Q4 { test }`
169
+ #^^^^^^^^ source.ts
170
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
171
+ # ^ source.ts meta.embedded.block.graphql
172
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
173
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
174
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
175
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
176
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
177
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
178
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
179
+ # ^ source.ts
180
+ >
181
+ >gql`
182
+ #^^^^ source.ts
183
+ > query Q5 {
184
+ #^^ source.ts meta.embedded.block.graphql
185
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
186
+ # ^ source.ts meta.embedded.block.graphql
187
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
188
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
189
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
190
+ > test
191
+ #^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
192
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
193
+ > }
194
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
195
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
196
+ >`;
197
+ #^ source.ts
198
+ # ^ source.ts punctuation.terminator.statement.ts
199
+ >
200
+ >gql<SomeResult, SomeVariables>`
201
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts
202
+ > query Q6 {
203
+ #^^ source.ts meta.embedded.block.graphql
204
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
205
+ # ^ source.ts meta.embedded.block.graphql
206
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
207
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
208
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
209
+ > test
210
+ #^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
211
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
212
+ > }
213
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
214
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
215
+ >`;
216
+ #^ source.ts
217
+ # ^ source.ts punctuation.terminator.statement.ts
218
+ >
219
+ >// prettier-ignore
220
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
221
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
222
+ >gql `
223
+ #^^^^^^^ source.ts
224
+ > query Q7 {
225
+ #^^ source.ts meta.embedded.block.graphql
226
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
227
+ # ^ source.ts meta.embedded.block.graphql
228
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
229
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
230
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
231
+ > test
232
+ #^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
233
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
234
+ > }
235
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
236
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
237
+ >`;
238
+ #^ source.ts
239
+ # ^ source.ts punctuation.terminator.statement.ts
240
+ >
241
+ >// syntax highlighting cannot work in all examples after this - textmate grammars don't work over multiple lines like this
242
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
243
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
244
+ >
245
+ >// prettier-ignore
246
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
247
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
248
+ >gql
249
+ #^^^ source.ts variable.other.readwrite.ts
250
+ >`query Q8 { test }`
251
+ #^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
252
+ # ^^^^^^^^^^^^^^^^^ source.ts string.template.ts
253
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
254
+ >
255
+ >// prettier-ignore
256
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
257
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
258
+ >gql<{
259
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
260
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
261
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
262
+ > test: string;
263
+ #^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts
264
+ # ^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
265
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
266
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
267
+ # ^^^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts
268
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.terminator.statement.ts
269
+ >},{
270
+ #^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
271
+ # ^ source.ts meta.type.parameters.ts punctuation.separator.comma.ts
272
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
273
+ > test: string;
274
+ #^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts
275
+ # ^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
276
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
277
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
278
+ # ^^^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts
279
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.terminator.statement.ts
280
+ >}>`query Q9 { test }`
281
+ #^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
282
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
283
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
284
+ # ^^^^^^^^^^^^^^^^^ source.ts string.template.ts
285
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
286
+ >
287
+ >gql<
288
+ #^^^ source.ts variable.other.readwrite.ts
289
+ # ^ source.ts keyword.operator.relational.ts
290
+ > {
291
+ #^^ source.ts
292
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
293
+ > test: string;
294
+ #^^^^ source.ts meta.block.ts
295
+ # ^^^^ source.ts meta.block.ts entity.name.label.ts
296
+ # ^ source.ts meta.block.ts punctuation.separator.label.ts
297
+ # ^ source.ts meta.block.ts
298
+ # ^^^^^^ source.ts meta.block.ts variable.other.readwrite.ts
299
+ # ^ source.ts meta.block.ts punctuation.terminator.statement.ts
300
+ > },
301
+ #^^ source.ts meta.block.ts
302
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
303
+ # ^ source.ts punctuation.separator.comma.ts
304
+ > {
305
+ #^^ source.ts
306
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
307
+ > test: string;
308
+ #^^^^ source.ts meta.block.ts
309
+ # ^^^^ source.ts meta.block.ts entity.name.label.ts
310
+ # ^ source.ts meta.block.ts punctuation.separator.label.ts
311
+ # ^ source.ts meta.block.ts
312
+ # ^^^^^^ source.ts meta.block.ts variable.other.readwrite.ts
313
+ # ^ source.ts meta.block.ts punctuation.terminator.statement.ts
314
+ > }
315
+ #^^ source.ts meta.block.ts
316
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
317
+ >>`
318
+ #^ source.ts keyword.operator.relational.ts
319
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
320
+ > query Q10 {
321
+ #^^^^^^^^^^^^^^ source.ts string.template.ts
322
+ > test
323
+ #^^^^^^^^^ source.ts string.template.ts
324
+ > }
325
+ #^^^^ source.ts string.template.ts
326
+ >`;
327
+ #^ source.ts string.template.ts punctuation.definition.string.template.end.ts
328
+ # ^ source.ts punctuation.terminator.statement.ts
329
+ >
330
+ >// prettier-ignore
331
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
332
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
333
+ >gql
334
+ #^^^ source.ts variable.other.readwrite.ts
335
+ >`
336
+ #^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
337
+ > query Q11 {
338
+ #^^^^^^^^^^^^^^ source.ts string.template.ts
339
+ > test
340
+ #^^^^^^^^^ source.ts string.template.ts
341
+ > }
342
+ #^^^^ source.ts string.template.ts
343
+ >`;
344
+ #^ source.ts string.template.ts punctuation.definition.string.template.end.ts
345
+ # ^ source.ts punctuation.terminator.statement.ts
346
+ >
347
+ >export {};
348
+ #^^^^^^ source.ts meta.export.ts keyword.control.export.ts
349
+ # ^ source.ts meta.export.ts
350
+ # ^ source.ts meta.export.ts meta.block.ts punctuation.definition.block.ts
351
+ # ^ source.ts meta.export.ts meta.block.ts punctuation.definition.block.ts
352
+ # ^ source.ts punctuation.terminator.statement.ts
353
+ >
@@ -0,0 +1,38 @@
1
+ // hint for reading the snapshots generated by this file:
2
+ // it is important to check that a rule doesn't only enter `meta.embedded.block.graphql`
3
+ // but also leaves it again
4
+
5
+ `#NormalComment
6
+ query Foo {test}`;
7
+
8
+ `#graphql
9
+ query Q1 {test}`;
10
+
11
+ ` # graphql
12
+ query Q2 {test}`;
13
+
14
+ `# GraphQL
15
+ query Q3 {
16
+ test
17
+ }`;
18
+
19
+ `#gql
20
+ # normal comment
21
+ query Q4 {
22
+ test
23
+ }`;
24
+
25
+ `#graphql
26
+ query Q5 {
27
+ test
28
+ }`;
29
+
30
+ // syntax highlighting cannot work in all examples after this - textmate grammars don't work over multiple lines like this
31
+ `
32
+
33
+ # graphql
34
+
35
+ query Q6 {
36
+ test
37
+ }
38
+ `;
@@ -0,0 +1,123 @@
1
+ >// hint for reading the snapshots generated by this file:
2
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
3
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
4
+ >// it is important to check that a rule doesn't only enter `meta.embedded.block.graphql`
5
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
6
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
7
+ >// but also leaves it again
8
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
9
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
10
+ >
11
+ >`#NormalComment
12
+ #^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
13
+ # ^^^^^^^^^^^^^^^ source.ts string.template.ts
14
+ >query Foo {test}`;
15
+ #^^^^^^^^^^^^^^^^ source.ts string.template.ts
16
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
17
+ # ^ source.ts punctuation.terminator.statement.ts
18
+ >
19
+ >`#graphql
20
+ #^ source.ts
21
+ # ^ source.ts meta.embedded.block.graphql comment.line.graphql.js
22
+ # ^^^^^^^ source.ts meta.embedded.block.graphql comment.line.graphql.js markup.italic
23
+ >query Q1 {test}`;
24
+ #^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
25
+ # ^ source.ts meta.embedded.block.graphql
26
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
27
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
28
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
29
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
30
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
31
+ # ^ source.ts
32
+ # ^ source.ts punctuation.terminator.statement.ts
33
+ >
34
+ >` # graphql
35
+ #^ source.ts
36
+ # ^^^ source.ts meta.embedded.block.graphql comment.line.graphql.js
37
+ # ^^^^^^^ source.ts meta.embedded.block.graphql comment.line.graphql.js markup.italic
38
+ >query Q2 {test}`;
39
+ #^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
40
+ # ^ source.ts meta.embedded.block.graphql
41
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
42
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
43
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
44
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
45
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
46
+ # ^ source.ts
47
+ # ^ source.ts punctuation.terminator.statement.ts
48
+ >
49
+ >`# GraphQL
50
+ #^ source.ts
51
+ # ^^ source.ts meta.embedded.block.graphql comment.line.graphql.js
52
+ # ^^^^^^^ source.ts meta.embedded.block.graphql comment.line.graphql.js markup.italic
53
+ >query Q3 {
54
+ #^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
55
+ # ^ source.ts meta.embedded.block.graphql
56
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
57
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
58
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
59
+ > test
60
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
61
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
62
+ >}`;
63
+ #^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
64
+ # ^ source.ts
65
+ # ^ source.ts punctuation.terminator.statement.ts
66
+ >
67
+ >`#gql
68
+ #^ source.ts
69
+ # ^ source.ts meta.embedded.block.graphql comment.line.graphql.js
70
+ # ^^^ source.ts meta.embedded.block.graphql comment.line.graphql.js markup.italic
71
+ ># normal comment
72
+ #^^^^^^^^^^^^^^^^ source.ts meta.embedded.block.graphql comment.line.graphql.js
73
+ >query Q4 {
74
+ #^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
75
+ # ^ source.ts meta.embedded.block.graphql
76
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
77
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
78
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
79
+ > test
80
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
81
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
82
+ >}`;
83
+ #^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
84
+ # ^ source.ts
85
+ # ^ source.ts punctuation.terminator.statement.ts
86
+ >
87
+ >`#graphql
88
+ #^ source.ts
89
+ # ^ source.ts meta.embedded.block.graphql comment.line.graphql.js
90
+ # ^^^^^^^ source.ts meta.embedded.block.graphql comment.line.graphql.js markup.italic
91
+ >query Q5 {
92
+ #^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
93
+ # ^ source.ts meta.embedded.block.graphql
94
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
95
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
96
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
97
+ > test
98
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
99
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
100
+ >}`;
101
+ #^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
102
+ # ^ source.ts
103
+ # ^ source.ts punctuation.terminator.statement.ts
104
+ >
105
+ >// syntax highlighting cannot work in all examples after this - textmate grammars don't work over multiple lines like this
106
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
107
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
108
+ >`
109
+ #^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
110
+ >
111
+ ># graphql
112
+ #^^^^^^^^^^ source.ts string.template.ts
113
+ >
114
+ >query Q6 {
115
+ #^^^^^^^^^^^ source.ts string.template.ts
116
+ > test
117
+ #^^^^^^^ source.ts string.template.ts
118
+ >}
119
+ #^^ source.ts string.template.ts
120
+ >`;
121
+ #^ source.ts string.template.ts punctuation.definition.string.template.end.ts
122
+ # ^ source.ts punctuation.terminator.statement.ts
123
+ >
@@ -99,9 +99,6 @@ Object {
99
99
  "**/node_modules",
100
100
  "**/__tests__",
101
101
  ],
102
- "includes": Array [
103
- "src/**/*.{ts,tsx,js,jsx,graphql,gql}",
104
- ],
105
102
  "service": "hello",
106
103
  "tagName": "gql",
107
104
  },
@@ -122,18 +119,28 @@ Object {
122
119
  }
123
120
  `,
124
121
  });
125
-
126
- const config = await loadConfig({
127
- configPath: dirPath,
128
- });
129
- expect(config?.rawConfig).toMatchInlineSnapshot(`
122
+ fs.mkdirSync(`${dir}/bin`);
123
+ fs.writeFileSync(`${dir}/bin/rover`, "", { mode: 0o755 });
124
+ let oldPath = process.env.PATH;
125
+ process.env.PATH = `${dir}/bin:${oldPath}`;
126
+ try {
127
+ const config = await loadConfig({
128
+ configPath: dirPath,
129
+ });
130
+ expect(config?.rawConfig).toMatchInlineSnapshot(`
130
131
  Object {
131
132
  "engine": Object {
132
133
  "endpoint": "https://graphql.api.apollographql.com/api/graphql",
133
134
  },
134
- "rover": Object {},
135
+ "rover": Object {
136
+ "bin": "${dir}/bin/rover",
137
+ "extraArgs": Array [],
138
+ },
135
139
  }
136
140
  `);
141
+ } finally {
142
+ process.env.PATH = oldPath;
143
+ }
137
144
  }));
138
145
 
139
146
  it("[deprecated] loads config from package.json", async () => {
@@ -267,7 +274,7 @@ Object {
267
274
  describe("env loading", () => {
268
275
  it("finds .env in config path & parses for key", async () => {
269
276
  writeFilesToDir(dir, {
270
- "apollo.config.js": `module.exports = { client: { name: 'hello' } }`,
277
+ "apollo.config.js": `module.exports = { client: { } }`,
271
278
  ".env": `APOLLO_KEY=service:harambe:54378950jn`,
272
279
  });
273
280
 
@@ -280,7 +287,7 @@ Object {
280
287
 
281
288
  it("finds .env.local in config path & parses for key", async () => {
282
289
  writeFilesToDir(dir, {
283
- "apollo.config.js": `module.exports = { client: { name: 'hello' } }`,
290
+ "apollo.config.js": `module.exports = { client: { } }`,
284
291
  ".env.local": `APOLLO_KEY=service:harambe:54378950jn`,
285
292
  });
286
293
 
@@ -293,7 +300,7 @@ Object {
293
300
 
294
301
  it("finds .env and .env.local in config path & parses for key, preferring .env.local", async () => {
295
302
  writeFilesToDir(dir, {
296
- "apollo.config.js": `module.exports = { client: { name: 'hello' } }`,
303
+ "apollo.config.js": `module.exports = { client: { } }`,
297
304
  ".env": `APOLLO_KEY=service:hamato:54378950jn`,
298
305
  ".env.local": `APOLLO_KEY=service:yoshi:65489061ko`,
299
306
  });
@@ -337,7 +344,7 @@ Object {
337
344
  it("infers rover projects from config", () =>
338
345
  withFeatureFlags("rover", async () => {
339
346
  writeFilesToDir(dir, {
340
- "apollo.config.js": `module.exports = { rover: {} }`,
347
+ "apollo.config.js": `module.exports = { rover: { bin: "/usr/bin/env" } }`,
341
348
  });
342
349
 
343
350
  const config = await loadConfig({
@@ -386,9 +393,14 @@ Object {
386
393
  configPath: dirPath,
387
394
  });
388
395
 
389
- expect((config?.rawConfig as any).client.includes).toEqual([
390
- "src/**/*.{ts,tsx,js,jsx,graphql,gql}",
391
- ]);
396
+ expect((config?.rawConfig as any).client.includes).toEqual(
397
+ /**
398
+ * This will be calculated in the `GraphQLInternalProject` constructor by calling `getSupportedExtensions()`
399
+ * which will have information about all the extensions added by other VSCode extensions for the language ids
400
+ * that Apollo supports.
401
+ */
402
+ undefined,
403
+ );
392
404
  });
393
405
 
394
406
  it("merges engine config defaults", async () => {