vscode-apollo 2.0.0 → 2.1.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 (39) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/.vscode/launch.json +4 -1
  3. package/CHANGELOG.md +33 -0
  4. package/package.json +9 -3
  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 +43 -10
  22. package/src/language-server/config/config.ts +26 -1
  23. package/src/language-server/config/loadConfig.ts +7 -1
  24. package/src/language-server/config/loadTsConfig.ts +70 -0
  25. package/src/language-server/config/which.d.ts +19 -0
  26. package/src/language-server/document.ts +86 -53
  27. package/src/language-server/fileSet.ts +7 -0
  28. package/src/language-server/project/base.ts +58 -316
  29. package/src/language-server/project/client.ts +730 -7
  30. package/src/language-server/project/internal.ts +349 -0
  31. package/src/language-server/project/rover/DocumentSynchronization.ts +308 -0
  32. package/src/language-server/project/rover/__tests__/DocumentSynchronization.test.ts +302 -0
  33. package/src/language-server/project/rover/project.ts +276 -0
  34. package/src/language-server/server.ts +129 -62
  35. package/src/language-server/utilities/__tests__/source.test.ts +162 -0
  36. package/src/language-server/utilities/source.ts +38 -3
  37. package/src/language-server/workspace.ts +34 -9
  38. package/syntaxes/graphql.js.json +18 -21
  39. package/src/language-server/languageProvider.ts +0 -795
@@ -0,0 +1,431 @@
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>(arg: string, ...args: any[]): 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 support.type.primitive.ts
36
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts
37
+ # ^ source.ts meta.function.ts meta.parameters.ts
38
+ # ^^^ source.ts meta.function.ts meta.parameters.ts keyword.operator.rest.ts
39
+ # ^^^^ source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
40
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
41
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
42
+ # ^^^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
43
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.tuple.ts meta.brace.square.ts
44
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.tuple.ts meta.brace.square.ts
45
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
46
+ # ^ source.ts meta.function.ts meta.return.type.ts keyword.operator.type.annotation.ts
47
+ # ^ source.ts meta.function.ts meta.return.type.ts
48
+ # ^^^^ source.ts meta.function.ts meta.return.type.ts support.type.primitive.ts
49
+ # ^ source.ts punctuation.terminator.statement.ts
50
+ >declare function foo<A = any, B = any>(...args: any[]): void;
51
+ #^^^^^^^ source.ts meta.function.ts storage.modifier.ts
52
+ # ^ source.ts meta.function.ts
53
+ # ^^^^^^^^ source.ts meta.function.ts storage.type.function.ts
54
+ # ^ source.ts meta.function.ts
55
+ # ^^^ source.ts meta.function.ts meta.definition.function.ts entity.name.function.ts
56
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
57
+ # ^ source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts
58
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
59
+ # ^ source.ts meta.function.ts meta.type.parameters.ts keyword.operator.assignment.ts
60
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
61
+ # ^^^ source.ts meta.function.ts meta.type.parameters.ts support.type.primitive.ts
62
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.separator.comma.ts
63
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
64
+ # ^ source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts
65
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
66
+ # ^ source.ts meta.function.ts meta.type.parameters.ts keyword.operator.assignment.ts
67
+ # ^ source.ts meta.function.ts meta.type.parameters.ts
68
+ # ^^^ source.ts meta.function.ts meta.type.parameters.ts support.type.primitive.ts
69
+ # ^ source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
70
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
71
+ # ^^^ source.ts meta.function.ts meta.parameters.ts keyword.operator.rest.ts
72
+ # ^^^^ source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
73
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
74
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
75
+ # ^^^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
76
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.tuple.ts meta.brace.square.ts
77
+ # ^ source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.tuple.ts meta.brace.square.ts
78
+ # ^ source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
79
+ # ^ source.ts meta.function.ts meta.return.type.ts keyword.operator.type.annotation.ts
80
+ # ^ source.ts meta.function.ts meta.return.type.ts
81
+ # ^^^^ source.ts meta.function.ts meta.return.type.ts support.type.primitive.ts
82
+ # ^ source.ts punctuation.terminator.statement.ts
83
+ >declare type SomeResult = any;
84
+ #^^^^^^^ source.ts meta.type.declaration.ts storage.modifier.ts
85
+ # ^ source.ts meta.type.declaration.ts
86
+ # ^^^^ source.ts meta.type.declaration.ts storage.type.type.ts
87
+ # ^ source.ts meta.type.declaration.ts
88
+ # ^^^^^^^^^^ source.ts meta.type.declaration.ts entity.name.type.alias.ts
89
+ # ^ source.ts meta.type.declaration.ts
90
+ # ^ source.ts meta.type.declaration.ts keyword.operator.assignment.ts
91
+ # ^ source.ts meta.type.declaration.ts
92
+ # ^^^ source.ts meta.type.declaration.ts support.type.primitive.ts
93
+ # ^ source.ts punctuation.terminator.statement.ts
94
+ >declare type SomeVariables = any;
95
+ #^^^^^^^ source.ts meta.type.declaration.ts storage.modifier.ts
96
+ # ^ source.ts meta.type.declaration.ts
97
+ # ^^^^ source.ts meta.type.declaration.ts storage.type.type.ts
98
+ # ^ source.ts meta.type.declaration.ts
99
+ # ^^^^^^^^^^^^^ source.ts meta.type.declaration.ts entity.name.type.alias.ts
100
+ # ^ source.ts meta.type.declaration.ts
101
+ # ^ source.ts meta.type.declaration.ts keyword.operator.assignment.ts
102
+ # ^ source.ts meta.type.declaration.ts
103
+ # ^^^ source.ts meta.type.declaration.ts support.type.primitive.ts
104
+ # ^ source.ts punctuation.terminator.statement.ts
105
+ >
106
+ >// for comparison - this is what a normal function all is colored
107
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
108
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
109
+ >foo(`query Foo { test }`);
110
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
111
+ # ^ source.ts meta.brace.round.ts
112
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
113
+ # ^^^^^^^^^^^^^^^^^^ source.ts string.template.ts
114
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
115
+ # ^ source.ts meta.brace.round.ts
116
+ # ^ source.ts punctuation.terminator.statement.ts
117
+ >
118
+ >// if possible, these should look the same
119
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
120
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
121
+ >foo("notATemplate");
122
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
123
+ # ^ source.ts meta.brace.round.ts
124
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.begin.ts
125
+ # ^^^^^^^^^^^^ source.ts string.quoted.double.ts
126
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.end.ts
127
+ # ^ source.ts meta.brace.round.ts
128
+ # ^ source.ts punctuation.terminator.statement.ts
129
+ >gql("notATemplate");
130
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
131
+ # ^ source.ts meta.brace.round.ts
132
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.begin.ts
133
+ # ^^^^^^^^^^^^ source.ts string.quoted.double.ts
134
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.end.ts
135
+ # ^ source.ts meta.brace.round.ts
136
+ # ^ source.ts punctuation.terminator.statement.ts
137
+ >foo<"">("notATemplate");
138
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
139
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
140
+ # ^ source.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.begin.ts
141
+ # ^ source.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.end.ts
142
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
143
+ # ^ source.ts meta.brace.round.ts
144
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.begin.ts
145
+ # ^^^^^^^^^^^^ source.ts string.quoted.double.ts
146
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.end.ts
147
+ # ^ source.ts meta.brace.round.ts
148
+ # ^ source.ts punctuation.terminator.statement.ts
149
+ >gql<"">("notATemplate");
150
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
151
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
152
+ # ^ source.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.begin.ts
153
+ # ^ source.ts meta.type.parameters.ts string.quoted.double.ts punctuation.definition.string.end.ts
154
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
155
+ # ^ source.ts meta.brace.round.ts
156
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.begin.ts
157
+ # ^^^^^^^^^^^^ source.ts string.quoted.double.ts
158
+ # ^ source.ts string.quoted.double.ts punctuation.definition.string.end.ts
159
+ # ^ source.ts meta.brace.round.ts
160
+ # ^ source.ts punctuation.terminator.statement.ts
161
+ >
162
+ >// prettier-ignore
163
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
164
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
165
+ >gql(`query Q1($arg: String!) { test }`)
166
+ #^^^^^ source.ts
167
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
168
+ # ^ source.ts meta.embedded.block.graphql
169
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
170
+ # ^ source.ts meta.embedded.block.graphql meta.brace.round.graphql
171
+ # ^^^^ source.ts meta.embedded.block.graphql meta.variables.graphql variable.parameter.graphql
172
+ # ^ source.ts meta.embedded.block.graphql meta.variables.graphql punctuation.colon.graphql
173
+ # ^ source.ts meta.embedded.block.graphql meta.variables.graphql
174
+ # ^^^^^^ source.ts meta.embedded.block.graphql meta.variables.graphql support.type.builtin.graphql
175
+ # ^ source.ts meta.embedded.block.graphql meta.variables.graphql keyword.operator.nulltype.graphql
176
+ # ^ source.ts meta.embedded.block.graphql meta.brace.round.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 meta.embedded.block.graphql meta.selectionset.graphql
180
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
181
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
182
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
183
+ # ^^ source.ts
184
+ >
185
+ >// prettier-ignore
186
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
187
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
188
+ >gql<SomeResult, SomeVariables>(`query Q2 { test }`)
189
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts
190
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
191
+ # ^ source.ts meta.embedded.block.graphql
192
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
193
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
194
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
195
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
196
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
197
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
198
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
199
+ # ^^ source.ts
200
+ >
201
+ >// prettier-ignore
202
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
203
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
204
+ >gql ( `query Q3 { test }` )
205
+ #^^^^^^^^^ source.ts
206
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
207
+ # ^ source.ts meta.embedded.block.graphql
208
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
209
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
210
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
211
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
212
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
213
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
214
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
215
+ # ^^^ source.ts
216
+ >
217
+ >gql(`
218
+ #^^^^^ source.ts
219
+ > query Q4 {
220
+ #^^ source.ts meta.embedded.block.graphql
221
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
222
+ # ^ source.ts meta.embedded.block.graphql
223
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
224
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
225
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
226
+ > test
227
+ #^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
228
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
229
+ > }
230
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
231
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
232
+ >`);
233
+ #^^ source.ts
234
+ # ^ source.ts punctuation.terminator.statement.ts
235
+ >
236
+ >// prettier-ignore
237
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
238
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
239
+ >gql ( `
240
+ #^^^^^^^^ source.ts
241
+ > query Q5 {
242
+ #^^ source.ts meta.embedded.block.graphql
243
+ # ^^^^^ source.ts meta.embedded.block.graphql keyword.operation.graphql
244
+ # ^ source.ts meta.embedded.block.graphql
245
+ # ^^ source.ts meta.embedded.block.graphql entity.name.function.graphql
246
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
247
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
248
+ > test
249
+ #^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
250
+ # ^^^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql variable.graphql
251
+ > }
252
+ #^^ source.ts meta.embedded.block.graphql meta.selectionset.graphql
253
+ # ^ source.ts meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql
254
+ >` );
255
+ #^^^ source.ts
256
+ # ^ source.ts punctuation.terminator.statement.ts
257
+ >
258
+ >// syntax highlighting cannot work in all examples after this - textmate grammars don't work over multiple lines like this
259
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
260
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
261
+ >
262
+ >gql<
263
+ #^^^ source.ts variable.other.readwrite.ts
264
+ # ^ source.ts keyword.operator.relational.ts
265
+ > {
266
+ #^^ source.ts
267
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
268
+ > test: string;
269
+ #^^^^ source.ts meta.block.ts
270
+ # ^^^^ source.ts meta.block.ts entity.name.label.ts
271
+ # ^ source.ts meta.block.ts punctuation.separator.label.ts
272
+ # ^ source.ts meta.block.ts
273
+ # ^^^^^^ source.ts meta.block.ts variable.other.readwrite.ts
274
+ # ^ source.ts meta.block.ts punctuation.terminator.statement.ts
275
+ > },
276
+ #^^ source.ts meta.block.ts
277
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
278
+ # ^ source.ts punctuation.separator.comma.ts
279
+ > {
280
+ #^^ source.ts
281
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
282
+ > test: string;
283
+ #^^^^ source.ts meta.block.ts
284
+ # ^^^^ source.ts meta.block.ts entity.name.label.ts
285
+ # ^ source.ts meta.block.ts punctuation.separator.label.ts
286
+ # ^ source.ts meta.block.ts
287
+ # ^^^^^^ source.ts meta.block.ts variable.other.readwrite.ts
288
+ # ^ source.ts meta.block.ts punctuation.terminator.statement.ts
289
+ > }
290
+ #^^ source.ts meta.block.ts
291
+ # ^ source.ts meta.block.ts punctuation.definition.block.ts
292
+ >>(`
293
+ #^ source.ts keyword.operator.relational.ts
294
+ # ^ source.ts meta.brace.round.ts
295
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
296
+ > query Q6 {
297
+ #^^^^^^^^^^^^^ source.ts string.template.ts
298
+ > test
299
+ #^^^^^^^^^ source.ts string.template.ts
300
+ > }
301
+ #^^^^ source.ts string.template.ts
302
+ >`);
303
+ #^ source.ts string.template.ts punctuation.definition.string.template.end.ts
304
+ # ^ source.ts meta.brace.round.ts
305
+ # ^ source.ts punctuation.terminator.statement.ts
306
+ >
307
+ >// prettier-ignore
308
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
309
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
310
+ >gql(
311
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
312
+ # ^ source.ts meta.brace.round.ts
313
+ >`
314
+ #^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
315
+ > query Q7 {
316
+ #^^^^^^^^^^^^^ source.ts string.template.ts
317
+ > test
318
+ #^^^^^^^^^ source.ts string.template.ts
319
+ > }
320
+ #^^^^ source.ts string.template.ts
321
+ >`
322
+ #^ source.ts string.template.ts punctuation.definition.string.template.end.ts
323
+ >);
324
+ #^ source.ts meta.brace.round.ts
325
+ # ^ source.ts punctuation.terminator.statement.ts
326
+ >
327
+ >gql<SomeResult, SomeVariables>(
328
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
329
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
330
+ # ^^^^^^^^^^ source.ts meta.type.parameters.ts entity.name.type.ts
331
+ # ^ source.ts meta.type.parameters.ts punctuation.separator.comma.ts
332
+ # ^ source.ts meta.type.parameters.ts
333
+ # ^^^^^^^^^^^^^ source.ts meta.type.parameters.ts entity.name.type.ts
334
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
335
+ # ^ source.ts meta.brace.round.ts
336
+ > // ts-ignore
337
+ #^^ source.ts punctuation.whitespace.comment.leading.ts
338
+ # ^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
339
+ # ^^^^^^^^^^ source.ts comment.line.double-slash.ts
340
+ > `
341
+ #^^ source.ts
342
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
343
+ > query Q8 {
344
+ #^^^^^^^^^^^^^ source.ts string.template.ts
345
+ > test
346
+ #^^^^^^^^^ source.ts string.template.ts
347
+ > }
348
+ #^^^^ source.ts string.template.ts
349
+ >`,
350
+ #^ source.ts string.template.ts punctuation.definition.string.template.end.ts
351
+ # ^ source.ts punctuation.separator.comma.ts
352
+ > `query {}`,
353
+ #^^ source.ts
354
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
355
+ # ^^^^^^^^ source.ts string.template.ts
356
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
357
+ # ^ source.ts punctuation.separator.comma.ts
358
+ >);
359
+ #^ source.ts meta.brace.round.ts
360
+ # ^ source.ts punctuation.terminator.statement.ts
361
+ >
362
+ >// prettier-ignore
363
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
364
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
365
+ >gql<{
366
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
367
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
368
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
369
+ > test: string;
370
+ #^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts
371
+ # ^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
372
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
373
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
374
+ # ^^^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts
375
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.terminator.statement.ts
376
+ >},{
377
+ #^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
378
+ # ^ source.ts meta.type.parameters.ts punctuation.separator.comma.ts
379
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
380
+ > test: string;
381
+ #^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts
382
+ # ^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
383
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
384
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
385
+ # ^^^^^^ source.ts meta.type.parameters.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts
386
+ # ^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.terminator.statement.ts
387
+ >}>(`query Q9 { test }`)
388
+ #^ source.ts meta.type.parameters.ts meta.object.type.ts punctuation.definition.block.ts
389
+ # ^ source.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
390
+ # ^ source.ts meta.brace.round.ts
391
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
392
+ # ^^^^^^^^^^^^^^^^^ source.ts string.template.ts
393
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
394
+ # ^ source.ts meta.brace.round.ts
395
+ >
396
+ >// prettier-ignore
397
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
398
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
399
+ >gql(
400
+ #^^^ source.ts meta.function-call.ts entity.name.function.ts
401
+ # ^ source.ts meta.brace.round.ts
402
+ >`query Q10 { test }`
403
+ #^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
404
+ # ^^^^^^^^^^^^^^^^^^ source.ts string.template.ts
405
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
406
+ >)
407
+ #^ source.ts meta.brace.round.ts
408
+ >
409
+ >// prettier-ignore
410
+ #^^ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
411
+ # ^^^^^^^^^^^^^^^^ source.ts comment.line.double-slash.ts
412
+ >gql
413
+ #^^^ source.ts variable.other.readwrite.ts
414
+ >(
415
+ #^ source.ts meta.brace.round.ts
416
+ > `query { test }`
417
+ #^^ source.ts
418
+ # ^ source.ts string.template.ts punctuation.definition.string.template.begin.ts
419
+ # ^^^^^^^^^^^^^^ source.ts string.template.ts
420
+ # ^ source.ts string.template.ts punctuation.definition.string.template.end.ts
421
+ > )
422
+ #^^ source.ts
423
+ # ^ source.ts meta.brace.round.ts
424
+ >
425
+ >export {};
426
+ #^^^^^^ source.ts meta.export.ts keyword.control.export.ts
427
+ # ^ source.ts meta.export.ts
428
+ # ^ source.ts meta.export.ts meta.block.ts punctuation.definition.block.ts
429
+ # ^ source.ts meta.export.ts meta.block.ts punctuation.definition.block.ts
430
+ # ^ source.ts punctuation.terminator.statement.ts
431
+ >
@@ -0,0 +1,80 @@
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
+ declare function gql<A = any, B = any>(strings: TemplateStringsArray): void;
6
+ declare function foo<A = any, B = any>(strings: TemplateStringsArray): void;
7
+ declare type SomeResult = any;
8
+ declare type SomeVariables = any;
9
+
10
+ // for comparison - this is what a normal function all is colored
11
+ foo`query Foo { test }`;
12
+ foo<SomeResult, SomeVariables>`query Foo { test }`;
13
+
14
+ // prettier-ignore
15
+ gql`query Q1 { test }`
16
+
17
+ // prettier-ignore
18
+ gql<SomeResult, SomeVariables>`query Q2 { test }`
19
+
20
+ // prettier-ignore
21
+ gql <SomeResult, SomeVariables> `
22
+ query Q3 { test }`
23
+
24
+ // prettier-ignore
25
+ gql `query Q4 { test }`
26
+
27
+ gql`
28
+ query Q5 {
29
+ test
30
+ }
31
+ `;
32
+
33
+ gql<SomeResult, SomeVariables>`
34
+ query Q6 {
35
+ test
36
+ }
37
+ `;
38
+
39
+ // prettier-ignore
40
+ gql `
41
+ query Q7 {
42
+ test
43
+ }
44
+ `;
45
+
46
+ // syntax highlighting cannot work in all examples after this - textmate grammars don't work over multiple lines like this
47
+
48
+ // prettier-ignore
49
+ gql
50
+ `query Q8 { test }`
51
+
52
+ // prettier-ignore
53
+ gql<{
54
+ test: string;
55
+ },{
56
+ test: string;
57
+ }>`query Q9 { test }`
58
+
59
+ gql<
60
+ {
61
+ test: string;
62
+ },
63
+ {
64
+ test: string;
65
+ }
66
+ >`
67
+ query Q10 {
68
+ test
69
+ }
70
+ `;
71
+
72
+ // prettier-ignore
73
+ gql
74
+ `
75
+ query Q11 {
76
+ test
77
+ }
78
+ `;
79
+
80
+ export {};