Repository navigation
Expand file tree
/
Copy pathfunction-protocol.json
More file actions
668 lines (668 loc) · 53.1 KB
/
Copy pathfunction-protocol.json
File metadata and controls
668 lines (668 loc) · 53.1 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
{
"schemaVersion": 1,
"protocol": "litheFunctions",
"offer": { "versions": [0] },
"negotiation": [
{
"name": "no answer leaves the protocol off",
"capabilities": { "hoverProvider": true },
"expected": { "functions": null }
},
{
"name": "an answer next to litheBuild is independent of it",
"capabilities": {
"experimental": {
"litheBuild": { "version": 0 },
"litheFunctions": { "version": 0, "functions": [{ "id": "snapshot.refresh" }] }
}
},
"expected": { "functions": ["snapshot.refresh"] }
},
{
"name": "a version without functions starts with an empty registry",
"capabilities": { "experimental": { "litheFunctions": { "version": 0 } } },
"expected": { "functions": [] }
},
{
"name": "unknown descriptor and answer fields are ignored",
"capabilities": {
"experimental": {
"litheFunctions": {
"version": 0,
"future": true,
"functions": [{ "id": "install.prepare", "title": "Prepare" }, { "id": "install.finish" }]
}
}
},
"expected": { "functions": ["install.finish", "install.prepare"] }
},
{
"name": "the negotiated version is reported next to the registry",
"capabilities": { "experimental": { "litheFunctions": { "version": 0, "functions": [{ "id": "query.run" }] } } },
"expected": { "functions": ["query.run"], "version": 0 }
},
{
"name": "a version the host never offered is not negotiated",
"capabilities": { "experimental": { "litheFunctions": { "version": 1 } } },
"expected": { "functions": null }
},
{
"name": "a version list is the offer shape, not an answer",
"capabilities": { "experimental": { "litheFunctions": { "versions": [0] } } },
"expected": { "functions": null }
},
{
"name": "a malformed function ID rejects the whole answer",
"capabilities": {
"experimental": {
"litheFunctions": { "version": 0, "functions": [{ "id": "ok" }, { "id": "Not-Valid" }] }
}
},
"expected": { "functions": null }
},
{
"name": "a duplicate function ID rejects the whole answer",
"capabilities": {
"experimental": {
"litheFunctions": { "version": 0, "functions": [{ "id": "refresh" }, { "id": "refresh" }] }
}
},
"expected": { "functions": null }
}
],
"registration": [
{
"name": "register adds functions",
"method": "lithe/function/register",
"registered": ["snapshot.refresh"],
"params": { "functions": [{ "id": "snapshot.clear" }] },
"expected": { "status": "accepted", "functions": ["snapshot.clear", "snapshot.refresh"], "removed": [] }
},
{
"name": "registering an existing ID is refused",
"method": "lithe/function/register",
"registered": ["snapshot.refresh"],
"params": { "functions": [{ "id": "snapshot.clear" }, { "id": "snapshot.refresh" }] },
"expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" }
},
{
"name": "an empty registration is refused",
"method": "lithe/function/register",
"registered": [],
"params": { "functions": [] },
"expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" }
},
{
"name": "a function ID with a separator other than a dot is refused",
"method": "lithe/function/register",
"registered": [],
"params": { "functions": [{ "id": "snapshot/refresh" }] },
"expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" }
},
{
"name": "unregister withdraws functions",
"method": "lithe/function/unregister",
"registered": ["snapshot.clear", "snapshot.refresh"],
"params": { "ids": ["snapshot.refresh"] },
"expected": { "status": "accepted", "functions": ["snapshot.clear"], "removed": ["snapshot.refresh"] }
},
{
"name": "unregistering an unknown ID is refused as a whole",
"method": "lithe/function/unregister",
"registered": ["snapshot.clear"],
"params": { "ids": ["snapshot.clear", "snapshot.refresh"] },
"expected": { "status": "rejected", "code": "plugin.function.invalidRegistration" }
}
],
"invocations": [
{
"name": "a registered function of the session's plugin is sent",
"session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.refresh"] },
"request": {
"function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" },
"params": { "project": "app" }
},
"expected": {
"status": "sent",
"method": "lithe/function/invoke",
"params": { "functionID": "snapshot.refresh", "operationID": "operation-1", "params": { "project": "app" } }
}
},
{
"name": "a malformed reference is refused before the session is consulted",
"session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.refresh"] },
"request": {
"function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "lithe/build/model" },
"params": {}
},
"expected": { "status": "refused", "code": "plugin.function.invalidReference" }
},
{
"name": "params must be an object",
"session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.refresh"] },
"request": {
"function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" },
"params": ["app"]
},
"expected": { "status": "refused", "code": "plugin.function.invalidParams" }
},
{
"name": "a session of another plugin is never reached",
"session": { "pluginID": "dev.lithe.fixture.gradle", "negotiated": true, "functions": ["snapshot.refresh"] },
"request": {
"function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" },
"params": {}
},
"expected": { "status": "refused", "code": "plugin.function.wrongPlugin" }
},
{
"name": "a host-owned session serves no plugin functions",
"session": { "pluginID": null, "negotiated": true, "functions": ["snapshot.refresh"] },
"request": {
"function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" },
"params": {}
},
"expected": { "status": "refused", "code": "plugin.function.unavailable" }
},
{
"name": "a backend that did not negotiate keeps serving its domain protocol only",
"session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": false, "functions": [] },
"request": {
"function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" },
"params": {}
},
"expected": { "status": "refused", "code": "plugin.function.unavailable" }
},
{
"name": "an unregistered function is unknown",
"session": { "pluginID": "dev.lithe.fixture.maven", "negotiated": true, "functions": ["snapshot.clear"] },
"request": {
"function": { "pluginID": "dev.lithe.fixture.maven", "functionID": "snapshot.refresh" },
"params": {}
},
"expected": { "status": "refused", "code": "plugin.function.unknown" }
}
],
"outcomes": [
{
"name": "a result is wrapped as value",
"response": { "jsonrpc": "2.0", "id": 4, "result": { "snapshot": 3 } },
"expected": { "result": { "value": { "snapshot": 3 } } }
},
{
"name": "a null result is a result",
"response": { "jsonrpc": "2.0", "id": 4, "result": null },
"expected": { "result": { "value": null } }
},
{
"name": "a response without result is invalid",
"response": { "jsonrpc": "2.0", "id": 4 },
"expected": {
"error": { "code": "plugin.function.invalidResult", "message": "The plugin function returned no result." }
}
},
{
"name": "an error keeps the backend message and a well-formed plugin code",
"response": {
"jsonrpc": "2.0",
"id": 4,
"error": { "code": -32000, "message": "Snapshot is locked.", "data": { "code": "maven.snapshotLocked" } }
},
"expected": {
"error": {
"code": "plugin.function.failed",
"message": "Snapshot is locked.",
"pluginErrorCode": "maven.snapshotLocked"
}
}
},
{
"name": "a malformed plugin code is dropped and an empty message replaced",
"response": {
"jsonrpc": "2.0",
"id": 4,
"error": { "code": -32000, "message": "", "data": { "code": "not a code" } }
},
"expected": {
"error": { "code": "plugin.function.failed", "message": "The plugin function failed." }
}
}
],
"progress": [
{
"name": "message and percentage are reported",
"params": { "operationID": "operation-1", "message": "Reading snapshot", "percentage": 40 },
"expected": { "operationID": "operation-1", "message": "Reading snapshot", "percentage": 40 }
},
{
"name": "both fields are optional",
"params": { "operationID": "operation-1" },
"expected": { "operationID": "operation-1" }
},
{
"name": "a percentage over 100 drops the report",
"params": { "operationID": "operation-1", "percentage": 101 },
"expected": null
},
{
"name": "a report without operation ID is dropped",
"params": { "message": "Working" },
"expected": null
}
],
"backendRequests": [
{
"name": "a backend cannot ask the host to invoke a function",
"method": "lithe/function/invoke",
"expected": { "code": "plugin.function.recursiveCall" }
},
{
"name": "a backend cannot ask the host for a build-domain operation",
"method": "lithe/build/model",
"expected": { "code": "plugin.function.recursiveCall" }
},
{
"name": "other methods keep the ordinary JSON-RPC answer",
"method": "workspace/applyEdit",
"expected": { "code": null }
}
],
"hostRequests": [
{"name": "workspace metadata never authorizes file reads", "version": 0, "hostServices": ["workspace"], "method": "lithe/host/workspace/readFile", "params": {"context": {"contextID": "w1", "generation": 1}}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "editor read method grant never authorizes edits", "version": 0, "hostServices": ["lithe/host/editor/getSelections"], "method": "lithe/host/editor/applyEdits", "params": {}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "only the explicit file method is forwarded", "version": 0, "hostServices": ["lithe/host/workspace/readFile"], "method": "lithe/host/workspace/readFile", "params": {"context": {"contextID": "w1", "generation": 1}, "resource": {"rootID": "r1", "path": "hello.txt"}}, "expected": {"forward": "workspace"}},
{
"name": "a granted credential read is forwarded to the host",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/credentials/get",
"params": { "key": "connection.prod" },
"expected": { "forward": "credentials" }
},
{
"name": "a credential write carries the secret",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/credentials/set",
"params": { "key": "connection.prod:password", "secret": "s3cret" },
"expected": { "forward": "credentials" }
},
{
"name": "a credential delete names only the key",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/credentials/delete",
"params": { "key": "connection.prod" },
"expected": { "forward": "credentials" }
},
{
"name": "a service the plugin's permissions do not grant is refused",
"version": 0,
"hostServices": [],
"method": "lithe/host/credentials/get",
"params": { "key": "connection.prod" },
"expected": { "rpcCode": -32010, "code": "plugin.host.permissionDenied" }
},
{
"name": "a key outside the alphabet is invalid",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/credentials/get",
"params": { "key": "../other-plugin" },
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "an empty key is invalid",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/credentials/delete",
"params": { "key": "" },
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "a write without a string secret is invalid",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/credentials/set",
"params": { "key": "connection.prod", "secret": 42 },
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "an unknown field is an option this host does not support",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/credentials/get",
"params": { "key": "connection.prod", "scope": "global" },
"expected": { "rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": { "option": "scope" } }
},
{
"name": "a context method names the option it does not support",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/getFolders",
"params": { "context": { "contextID": "w-3f2a", "generation": 1 }, "includeHidden": true },
"expected": { "rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": { "option": "includeHidden" } }
},
{
"name": "Core answers capability discovery with only the session's grants",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/getCapabilities",
"params": {},
"expected": {
"answer": {
"protocolVersion": 0,
"backendAuthority": "local",
"services": {
"commands": { "methods": [], "notifications": ["lithe/host/commands/didRun"] },
"host": { "methods": ["lithe/host/getCapabilities"], "notifications": [] },
"subscriptions": {
"methods": ["lithe/host/subscriptions/dispose"],
"notifications": ["lithe/host/subscriptions/notify"]
},
"workspace": {
"methods": [
"lithe/host/workspace/listContexts",
"lithe/host/workspace/getContext",
"lithe/host/workspace/getFolders"
],
"notifications": ["lithe/host/workspace/didChangeContexts"]
}
},
"limits": {
"pendingHostRequests": 16,
"functionResultBytes": 1048576,
"hostRequestBytes": 1048576,
"hostResultBytes": 1048576,
"errorMessageBytes": 1024,
"errorDetailsBytes": 4096,
"notificationBytes": 1048576
}
}
}
},
{
"name": "capability discovery takes no options yet",
"version": 0,
"hostServices": [],
"method": "lithe/host/getCapabilities",
"params": { "services": ["credentials"] },
"expected": { "rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": { "option": "services" } }
},
{
"name": "listing workspace contexts is forwarded when workspace.metadata is granted",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/listContexts",
"expected": { "forward": "workspace" }
},
{
"name": "workspace contexts need the workspace.metadata grant",
"version": 0,
"hostServices": ["credentials"],
"method": "lithe/host/workspace/listContexts",
"params": {},
"expected": { "rpcCode": -32010, "code": "plugin.host.permissionDenied" }
},
{
"name": "a context's folders are asked for by context ID and generation",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/getFolders",
"params": { "context": { "contextID": "w-3f2a", "generation": 2 } },
"expected": { "forward": "workspace" }
},
{
"name": "one context is asked for by context ID and generation",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/getContext",
"params": { "context": { "contextID": "w-3f2a", "generation": 2 } },
"expected": { "forward": "workspace" }
},
{
"name": "a context without a generation is invalid",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/getFolders",
"params": { "context": { "contextID": "w-3f2a" } },
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "a generation is positive",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/getContext",
"params": { "context": { "contextID": "w-3f2a", "generation": 0 } },
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "a context ID outside the alphabet is invalid",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/getContext",
"params": { "context": { "contextID": "../w", "generation": 1 } },
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "a context reference has no other fields",
"version": 0,
"hostServices": ["workspace"],
"method": "lithe/host/workspace/getContext",
"params": { "context": { "contextID": "w-3f2a", "generation": 1, "path": "/tmp" } },
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "a subscription is disposed by its ID without any grant",
"version": 0,
"hostServices": [],
"method": "lithe/host/subscriptions/dispose",
"params": { "subscriptionID": "watch-1" },
"expected": { "forward": "subscriptions" }
},
{
"name": "disposing needs a subscription ID",
"version": 0,
"hostServices": [],
"method": "lithe/host/subscriptions/dispose",
"params": {},
"expected": { "rpcCode": -32602, "code": "plugin.host.invalidParams" }
},
{
"name": "a method no version defines is unavailable",
"version": 0,
"hostServices": ["credentials", "workspace"],
"method": "lithe/host/process/run",
"params": {},
"expected": { "rpcCode": -32601, "code": "plugin.host.unavailable" }
},
{"name": "editor actions are a discoverable independent host service", "method": "lithe/host/editor/registerActions", "version": 0, "hostServices": ["lithe/host/editor/registerActions"], "params": {"context": {"contextID": "w1", "generation": 1}, "id": "actions", "function": "actions.collect", "selector": {"fileExtensions": ["http"]}}, "expected": {"forward": "editor"}},
{"name": "document reads do not grant editor action contribution", "method": "lithe/host/editor/registerActions", "version": 0, "hostServices": ["lithe/host/documents/getSnapshot"], "params": {}, "expected": {"code": "plugin.host.permissionDenied", "rpcCode": -32010}},
{"name": "terminal create is an individually granted method", "version": 0, "hostServices": ["lithe/host/terminal/create"], "method": "lithe/host/terminal/create", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "executable": "example-tool"}, "expected": {"forward": "terminal"}},
{"name": "terminal show is an individually granted method", "version": 0, "hostServices": ["lithe/host/terminal/show"], "method": "lithe/host/terminal/show", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}},
{"name": "terminal close is an individually granted method", "version": 0, "hostServices": ["lithe/host/terminal/close"], "method": "lithe/host/terminal/close", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}},
{"name": "terminal onExit is an individually granted method", "version": 0, "hostServices": ["lithe/host/terminal/onExit"], "method": "lithe/host/terminal/onExit", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}},
{"name": "terminal aggregate grant cannot authorize terminal creation", "version": 0, "hostServices": ["terminal"], "method": "lithe/host/terminal/create", "params": {}, "expected": {"code": "plugin.host.permissionDenied", "rpcCode": -32010}},
{"name": "terminal reopen is granted", "version": 0, "hostServices": ["lithe/host/terminal/reopen"], "method": "lithe/host/terminal/reopen", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}},
{"name": "terminal dispose is granted", "version": 0, "hostServices": ["lithe/host/terminal/dispose"], "method": "lithe/host/terminal/dispose", "params": {"context": {"contextID": "w-terminal", "generation": 1}, "terminalID": "owned"}, "expected": {"forward": "terminal"}},
{ "name": "a run start is granted", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/start", "params": { "context": { "contextID": "w-run", "generation": 1 }, "label": "Run app" }, "expected": { "forward": "run" } },
{ "name": "a run stop is granted", "version": 0, "hostServices": ["lithe/host/run/stop"], "method": "lithe/host/run/stop", "params": { "context": { "contextID": "w-run", "generation": 1 }, "runID": "r1" }, "expected": { "forward": "run" } },
{ "name": "a run start needs its own grant", "version": 0, "hostServices": ["lithe/host/run/stop"], "method": "lithe/host/run/start", "params": { "context": { "contextID": "w-run", "generation": 1 } }, "expected": { "code": "plugin.host.permissionDenied", "rpcCode": -32010 } },
{ "name": "a run start takes an object", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/start", "params": [], "expected": { "code": "plugin.host.invalidParams", "rpcCode": -32602 } },
{ "name": "a debug start is granted", "version": 0, "hostServices": ["lithe/host/debug/start"], "method": "lithe/host/debug/start", "params": { "context": { "contextID": "w-run", "generation": 1 }, "label": "Debug app" }, "expected": { "forward": "debug" } },
{ "name": "a debug start is not covered by the run grant", "version": 0, "hostServices": ["lithe/host/run/start", "lithe/host/run/stop"], "method": "lithe/host/debug/start", "params": { "context": { "contextID": "w-run", "generation": 1 } }, "expected": { "code": "plugin.host.permissionDenied", "rpcCode": -32010 } },
{"name": "a language server request is forwarded when languageServer.request is granted", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "params": {"verbose": true}}, "expected": {"forward": "languageServer"}},
{"name": "a language server request may bound its own timeout", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "rust-analyzer", "method": "rust-analyzer/expandMacro", "params": {}, "timeoutMilliseconds": 300000}, "expected": {"forward": "languageServer"}},
{"name": "a language server request may run a declared command", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "workspace/executeCommand", "params": {"command": "metals.build-import"}}, "expected": {"forward": "languageServer"}},
{"name": "a language server notification is forwarded", "version": 0, "hostServices": ["lithe/host/languageServer/notify"], "method": "lithe/host/languageServer/notify", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "workspace/didChangeConfiguration", "params": {"settings": {}}}, "expected": {"forward": "languageServer"}},
{"name": "a language server status is forwarded", "version": 0, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "preparing", "message": "Importing build", "percentage": 40}, "expected": {"forward": "languageServer"}},
{"name": "a language server status may omit the message and the percentage", "version": 0, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "rust-analyzer", "state": "ready"}, "expected": {"forward": "languageServer"}},
{"name": "a language server request needs the languageServer.request grant", "version": 0, "hostServices": [], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "another service's grant never authorizes a language server request", "version": 0, "hostServices": ["workspace"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "the aggregate service name never authorizes a language server request", "version": 0, "hostServices": ["languageServer"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "a notify grant never authorizes a language server request", "version": 0, "hostServices": ["lithe/host/languageServer/notify"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "a language server request needs a context", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"serverID": "metals", "method": "metals/doctorRun"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server request names a server", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "method": "metals/doctorRun"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server request names a method", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server request refuses an empty method", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": ""}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server request timeout is positive", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "timeoutMilliseconds": 0}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server request timeout has an upper bound", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "timeoutMilliseconds": 300001}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server request names the option it does not support", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/request", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/doctorRun", "workspaceFolder": "/tmp"}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "workspaceFolder"}}},
{"name": "a language server notification takes no timeout", "version": 0, "hostServices": ["lithe/host/languageServer/notify"], "method": "lithe/host/languageServer/notify", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "workspace/didChangeConfiguration", "timeoutMilliseconds": 5}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "timeoutMilliseconds"}}},
{"name": "a language server status state is a closed set", "version": 0, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "importing"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server status percentage stops at one hundred", "version": 0, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "preparing", "percentage": 101}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server status percentage is a whole number", "version": 0, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "preparing", "percentage": 12.5}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server status message is text", "version": 0, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "failed", "message": {"text": "x"}}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a language server status has no method field", "version": 0, "hostServices": ["lithe/host/languageServer/setStatus"], "method": "lithe/host/languageServer/setStatus", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "ready", "method": "x"}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "method"}}},
{"name": "a content provider is registered with the documents.contentProvider grant", "version": 0, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "documents.read"}, "expected": {"forward": "documents"}},
{"name": "the aggregate documents name never authorizes a content provider", "version": 0, "hostServices": ["documents"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "documents.read"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "a content provider needs its own grant", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "documents.read"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "a content provider cannot serve a scheme the host owns", "version": 0, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "file", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a content provider cannot serve the lithe scheme", "version": 0, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "lithe", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a content scheme is lowercase", "version": 0, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "Metals", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a content scheme starts with a letter", "version": 0, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "1metals", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a content provider names a plugin function", "version": 0, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"context": {"contextID": "w1", "generation": 1}, "scheme": "metals-library", "function": "not a function"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a content provider needs a context", "version": 0, "hostServices": ["lithe/host/documents/registerContentProvider"], "method": "lithe/host/documents/registerContentProvider", "params": {"scheme": "metals-library", "function": "documents.read"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a declared caller lists the providers of a function", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/providers", "params": {"functionID": "languageImport.settings"}, "expected": {"relay": true}},
{"name": "a declared caller invokes another plugin's function through the relay", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": {"project": "app"}, "timeoutMilliseconds": 5000}, "expected": {"relay": true}},
{"name": "a nested invocation names the relayed call it belongs to", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": {"project": "app"}, "timeoutMilliseconds": 5000, "parentOperationID": "17"}, "expected": {"relay": true}},
{"name": "an invocation's parent operation ID is a string", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": {"project": "app"}, "timeoutMilliseconds": 5000, "parentOperationID": 17}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "the relay needs the manifest's pluginFunctions calls", "version": 0, "hostServices": [], "method": "lithe/host/functions/providers", "params": {"functionID": "languageImport.settings"}, "expected": {"rpcCode": -32010, "code": "plugin.host.permissionDenied"}},
{"name": "an invocation names the workspace context it runs in", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings"}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "an invocation's function ID is well formed", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "Not-Valid", "context": {"contextID": "w1", "generation": 1}}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "an invocation's params are an object", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "params": [1]}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "an invocation's timeout is positive", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "timeoutMilliseconds": 0}, "expected": {"rpcCode": -32602, "code": "plugin.host.invalidParams"}},
{"name": "a caller cannot choose who the callee thinks called", "version": 0, "hostServices": ["functions"], "method": "lithe/host/functions/invoke", "params": {"pluginID": "dev.lithe.fixture.go", "functionID": "languageImport.settings", "context": {"contextID": "w1", "generation": 1}, "caller": {"pluginID": "dev.lithe.fixture.other"}}, "expected": {"rpcCode": -32018, "code": "plugin.host.unsupportedOption", "details": {"option": "caller"}}}
],
"invocationCallers": [
{
"name": "a callee receives the plugin that called it",
"version": 0,
"params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} },
"caller": "dev.lithe.fixture.python",
"expected": {
"params": {
"functionID": "languageImport.settings",
"operationID": "7",
"params": {},
"caller": { "pluginID": "dev.lithe.fixture.python" }
}
}
},
{
"name": "a call the host started has no caller, which means the host",
"version": 0,
"params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} },
"expected": { "params": { "functionID": "languageImport.settings", "operationID": "7", "params": {} } }
},
{
"name": "Core's caller replaces any field the params already carried",
"version": 0,
"params": { "functionID": "languageImport.settings", "operationID": "7", "params": {}, "caller": { "pluginID": "dev.lithe.fixture.other" } },
"caller": "dev.lithe.fixture.python",
"expected": {
"params": {
"functionID": "languageImport.settings",
"operationID": "7",
"params": {},
"caller": { "pluginID": "dev.lithe.fixture.python" }
}
}
}
],
"relayErrors": [
{ "name": "the caller did not declare the call", "code": "plugin.function.notDeclared", "rpcCode": -32027 },
{ "name": "the provider does not export the function", "code": "plugin.function.notExported", "rpcCode": -32028 },
{ "name": "the provider is not enabled", "code": "plugin.function.providerDisabled", "rpcCode": -32029 },
{ "name": "the declared and exported contract versions differ", "code": "plugin.function.versionMismatch", "rpcCode": -32030 },
{ "name": "the provider is already on the call chain", "code": "plugin.function.callCycle", "rpcCode": -32065 },
{ "name": "the call chain is too long", "code": "plugin.function.depthExceeded", "rpcCode": -32066 },
{ "name": "the caller has too many relayed calls running", "code": "plugin.function.tooManyCalls", "rpcCode": -32067 },
{ "name": "the params or result exceed the relay's bound", "code": "plugin.function.payloadTooLarge", "rpcCode": -32068 },
{ "name": "the provider's backend could not serve the call", "code": "plugin.function.providerUnavailable", "rpcCode": -32069 },
{ "name": "the provider's function answered with an error", "code": "plugin.function.failed", "rpcCode": -32070 },
{ "name": "the provider answered without a result Core can pass on", "code": "plugin.function.invalidResult", "rpcCode": -32071 },
{ "name": "the relay's own deadline passed", "code": "plugin.host.timeout", "rpcCode": -32015 },
{ "name": "the caller or an upstream caller cancelled", "code": "plugin.host.cancelled", "rpcCode": -32800 },
{ "name": "the workspace context is unknown or replaced", "code": "plugin.host.contextExpired", "rpcCode": -32011 },
{ "name": "the workspace is remote", "code": "plugin.host.authorityUnsupported", "rpcCode": -32012 }
],
"invocationContexts": [
{
"name": "a backend receives the call's context",
"version": 0,
"params": { "functionID": "query.run", "operationID": "7", "params": {} },
"context": { "contextID": "w-3f2a", "generation": 2 },
"expected": {
"params": { "functionID": "query.run", "operationID": "7", "params": {}, "context": { "contextID": "w-3f2a", "generation": 2 } }
}
},
{
"name": "a call without a context is unchanged",
"version": 0,
"params": { "functionID": "query.run", "operationID": "7", "params": {} },
"expected": { "params": { "functionID": "query.run", "operationID": "7", "params": {} } }
},
{
"name": "a malformed context never leaves Core",
"version": 0,
"params": { "functionID": "query.run", "operationID": "7", "params": {} },
"context": { "contextID": "w-3f2a", "generation": -1 },
"expected": { "code": "plugin.function.invalidParams" }
}
],
"hostFailures": [
{ "name": "no code is a generic failure", "code": null, "expected": { "code": "plugin.host.failed", "rpcCode": -32603 } },
{ "name": "a closed or replaced context", "code": "plugin.host.contextExpired", "expected": { "code": "plugin.host.contextExpired", "rpcCode": -32011 } },
{ "name": "a remote authority without the operation", "code": "plugin.host.authorityUnsupported", "expected": { "code": "plugin.host.authorityUnsupported", "rpcCode": -32012 } },
{ "name": "a stale versioned edit", "code": "plugin.host.versionConflict", "expected": { "code": "plugin.host.versionConflict", "rpcCode": -32013 } },
{ "name": "a host limit", "code": "plugin.host.limitExceeded", "expected": { "code": "plugin.host.limitExceeded", "rpcCode": -32014 } },
{ "name": "the host stopped the request", "code": "plugin.host.cancelled", "expected": { "code": "plugin.host.cancelled", "rpcCode": -32800 } },
{ "name": "the host's deadline passed", "code": "plugin.host.timeout", "expected": { "code": "plugin.host.timeout", "rpcCode": -32015 } },
{ "name": "params the service itself refuses", "code": "plugin.host.invalidParams", "expected": { "code": "plugin.host.invalidParams", "rpcCode": -32602 } },
{ "name": "the user withheld consent", "code": "plugin.host.permissionDenied", "expected": { "code": "plugin.host.permissionDenied", "rpcCode": -32010 } },
{ "name": "a service the host turned off", "code": "plugin.host.unavailable", "expected": { "code": "plugin.host.unavailable", "rpcCode": -32601 } },
{ "name": "the target does not exist", "code": "plugin.host.notFound", "expected": { "code": "plugin.host.notFound", "rpcCode": -32016 } },
{ "name": "the target cannot be written", "code": "plugin.host.readOnly", "expected": { "code": "plugin.host.readOnly", "rpcCode": -32017 } },
{ "name": "an option this host does not support", "code": "plugin.host.unsupportedOption", "expected": { "code": "plugin.host.unsupportedOption", "rpcCode": -32018 } },
{ "name": "a state the operation needs is missing", "code": "plugin.host.preconditionFailed", "expected": { "code": "plugin.host.preconditionFailed", "rpcCode": -32019 } },
{ "name": "the host is busy and the request may be retried", "code": "plugin.host.busy", "expected": { "code": "plugin.host.busy", "rpcCode": -32020 } },
{ "name": "the plugin sent requests too often", "code": "plugin.host.rateLimited", "expected": { "code": "plugin.host.rateLimited", "rpcCode": -32021 } },
{ "name": "a host cannot borrow a function code", "code": "plugin.function.unknown", "expected": { "code": "plugin.host.failed", "rpcCode": -32603 } },
{ "name": "a host cannot report a backend exit to the backend", "code": "plugin.backend.exited", "expected": { "code": "plugin.host.failed", "rpcCode": -32603 } },
{ "name": "a tool the host cannot resolve", "code": "plugin.host.toolUnresolved", "expected": { "code": "plugin.host.toolUnresolved", "rpcCode": -32025 } },
{"name": "the plugin's language server is not running", "code": "plugin.host.languageServerUnavailable", "expected": {"code": "plugin.host.languageServerUnavailable", "rpcCode": -32022}},
{"name": "the language server answered with an error", "code": "plugin.host.languageServerError", "expected": {"code": "plugin.host.languageServerError", "rpcCode": -32023}},
{"name": "the method is not in the language server's declared session", "code": "plugin.host.methodNotDeclared", "expected": {"code": "plugin.host.methodNotDeclared", "rpcCode": -32024}},
{"name": "the server belongs to another plugin", "code": "plugin.host.foreignContribution", "expected": {"code": "plugin.host.foreignContribution", "rpcCode": -32026}}
],
"hostNotifications": [
{ "name": "changed contexts reach a workspace session", "version": 0, "hostServices": ["workspace"], "method": "lithe/host/workspace/didChangeContexts", "params": { "revision": 4 }, "expected": { "delivered": true } },
{ "name": "changed contexts need the workspace grant", "version": 0, "hostServices": [], "method": "lithe/host/workspace/didChangeContexts", "params": { "revision": 4 }, "expected": { "code": "plugin.host.permissionDenied" } },
{ "name": "a revision is positive", "version": 0, "hostServices": ["workspace"], "method": "lithe/host/workspace/didChangeContexts", "params": { "revision": 0 }, "expected": { "code": "plugin.host.invalidParams" } },
{ "name": "a subscription event", "version": 0, "hostServices": [], "method": "lithe/host/subscriptions/notify", "params": { "subscriptionID": "s1", "sequence": 1, "event": { "kind": "changed" } }, "expected": { "delivered": true } },
{ "name": "a subscription event is an object", "version": 0, "hostServices": [], "method": "lithe/host/subscriptions/notify", "params": { "subscriptionID": "s1", "sequence": 1, "event": "changed" }, "expected": { "code": "plugin.host.invalidParams" } },
{ "name": "a command run in a window", "version": 0, "hostServices": [], "method": "lithe/host/commands/didRun", "params": { "commandID": "db.refresh", "context": { "contextID": "w1", "generation": 2 } }, "expected": { "delivered": true } },
{ "name": "a command without a window", "version": 0, "hostServices": [], "method": "lithe/host/commands/didRun", "params": { "commandID": "db.refresh" }, "expected": { "delivered": true } },
{ "name": "extra command params are refused", "version": 0, "hostServices": [], "method": "lithe/host/commands/didRun", "params": { "commandID": "db.refresh", "path": "/etc" }, "expected": { "code": "plugin.host.invalidParams" } },
{ "name": "the host cannot call the backend's own protocol", "version": 0, "hostServices": [], "method": "lithe/functions/invoke", "params": {}, "expected": { "code": "plugin.host.unavailable" } },
{ "name": "a run exit with a status", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "exitCode": 0 }, "expected": { "delivered": true } },
{ "name": "a run exit by signal", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "signal": 9 }, "expected": { "delivered": true } },
{ "name": "a run exit the host lost track of", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1" }, "expected": { "delivered": true } },
{ "name": "a run exit needs the run grant", "version": 0, "hostServices": ["lithe/host/debug/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "exitCode": 0 }, "expected": { "code": "plugin.host.permissionDenied" } },
{ "name": "a run exit status is a 32-bit integer", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "exitCode": 4294967296 }, "expected": { "code": "plugin.host.invalidParams" } },
{ "name": "a run exit signal is a signal number", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "runID": "r1", "signal": 0 }, "expected": { "code": "plugin.host.invalidParams" } },
{ "name": "a run exit names its run", "version": 0, "hostServices": ["lithe/host/run/start"], "method": "lithe/host/run/didExit", "params": { "exitCode": 0 }, "expected": { "code": "plugin.host.invalidParams" } },
{"name": "a language server changed state", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "running", "generation": 3}, "expected": {"delivered": true}},
{"name": "a language server state is a closed set", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "ready", "generation": 3}, "expected": {"code": "plugin.host.invalidParams"}},
{"name": "a language server state names its generation", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "stopped"}, "expected": {"code": "plugin.host.invalidParams"}},
{"name": "a language server state generation is positive", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "crashed", "generation": 0}, "expected": {"code": "plugin.host.invalidParams"}},
{"name": "a language server state needs the languageServer.request grant", "version": 0, "hostServices": [], "method": "lithe/host/languageServer/didChangeState", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "state": "running", "generation": 1}, "expected": {"code": "plugin.host.permissionDenied"}},
{"name": "a forwarded server notification carries its params", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "params": {"text": "Importing"}}, "expected": {"delivered": true}},
{"name": "an oversized server notification is marked truncated without params", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "truncated": true}, "expected": {"delivered": true}},
{"name": "a truncated server notification drops its params", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "params": {}, "truncated": true}, "expected": {"code": "plugin.host.invalidParams"}},
{"name": "a server notification names its method", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2}, "expected": {"code": "plugin.host.invalidParams"}},
{"name": "a server notification names its generation", "version": 0, "hostServices": ["lithe/host/languageServer/request"], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "method": "metals/status", "params": {}}, "expected": {"code": "plugin.host.invalidParams"}},
{"name": "a server notification needs the languageServer.request grant", "version": 0, "hostServices": [], "method": "lithe/host/languageServer/didReceiveNotification", "params": {"context": {"contextID": "w1", "generation": 1}, "serverID": "metals", "generation": 2, "method": "metals/status", "params": {}}, "expected": {"code": "plugin.host.permissionDenied"}}
]
}