@github/copilot-language-server 1.551.3 → 1.553.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.
- package/README.md +94 -1
- package/dist/main.js +1022 -1010
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -421,6 +421,97 @@ legacy client behavior. The corrected reporting ships with the implementing
|
|
|
421
421
|
CLS/plugin versions, without a separate rollout flag; original model experiment
|
|
422
422
|
assignments are still preserved.
|
|
423
423
|
|
|
424
|
+
## Unified Suggestions
|
|
425
|
+
|
|
426
|
+
`textDocument/copilotSuggest` is a custom method that asks for inline completions and next edit suggestions in one
|
|
427
|
+
request. The server calls the providers the trigger reason allows, picks the winner, and returns at most one
|
|
428
|
+
suggestion, so the client does not have to choose between the two. `textDocument/inlineCompletion` and
|
|
429
|
+
`textDocument/copilotInlineEdit` are unchanged and remain available.
|
|
430
|
+
|
|
431
|
+
The parameters combine those of the two methods and add the `reason` for the request:
|
|
432
|
+
|
|
433
|
+
```json
|
|
434
|
+
{
|
|
435
|
+
"textDocument": {
|
|
436
|
+
"uri": "file:///path/to/file",
|
|
437
|
+
"version": 0
|
|
438
|
+
},
|
|
439
|
+
"position": {"line": 1, "character": 2},
|
|
440
|
+
"reason": "typing",
|
|
441
|
+
"include": {"completions": true, "edits": true},
|
|
442
|
+
"formattingOptions": {
|
|
443
|
+
"tabSize": 4,
|
|
444
|
+
"insertSpaces": true
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
`reason` decides which providers are asked:
|
|
450
|
+
|
|
451
|
+
| `reason` | Asks for |
|
|
452
|
+
| --- | --- |
|
|
453
|
+
| `typing` | Completions and next edits |
|
|
454
|
+
| `manual` | Completions |
|
|
455
|
+
| `cycling` | Completions, with alternatives to cycle through |
|
|
456
|
+
| `caretMove` | Next edits |
|
|
457
|
+
| `postAccept` | Next edits |
|
|
458
|
+
|
|
459
|
+
An unknown `reason` is treated as `typing`. The optional `include` switches off a provider that the reason allows, for
|
|
460
|
+
example to honor a user setting; it never switches one on. `context.selectedCompletionInfo` and `formattingOptions`
|
|
461
|
+
mean the same as for `textDocument/inlineCompletion`, and `diagnostics`, if given, is passed to the next edit provider
|
|
462
|
+
as with `textDocument/copilotInlineEdit`.
|
|
463
|
+
|
|
464
|
+
A completion wins when it inserts new text; one that only repeats text already after the cursor is dropped. Otherwise
|
|
465
|
+
the first next edit wins. The result is an object with an optional `suggestion`, absent when there is nothing to show:
|
|
466
|
+
|
|
467
|
+
```json
|
|
468
|
+
{
|
|
469
|
+
"suggestion": {
|
|
470
|
+
"id": "some-id",
|
|
471
|
+
"kind": "completion",
|
|
472
|
+
"presentation": "ghostText",
|
|
473
|
+
"target": {
|
|
474
|
+
"uri": "file:///path/to/file",
|
|
475
|
+
"version": 0
|
|
476
|
+
},
|
|
477
|
+
"items": [
|
|
478
|
+
{
|
|
479
|
+
"text": "a helpful suggestion",
|
|
480
|
+
"range": {
|
|
481
|
+
"start": {"line": 1, "character": 0},
|
|
482
|
+
"end": {"line": 1, "character": 2}
|
|
483
|
+
},
|
|
484
|
+
"command": {
|
|
485
|
+
"title": "Completion Accepted",
|
|
486
|
+
"command": "github.copilot.didAcceptCompletionItem",
|
|
487
|
+
"arguments": ["some-id"]
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
],
|
|
491
|
+
"provenance": {"viaProxy": true, "model": "some-model", "fromCache": false}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
- `kind` is what the suggestion is: `completion`, `edit`, or `jump`, an edit in another document named by `target`.
|
|
497
|
+
It decides how outcomes are reported.
|
|
498
|
+
- `presentation` is how to draw it: `ghostText`, `diff`, or `jump`. Draw by `presentation` and report by `kind`; the
|
|
499
|
+
two can differ in future versions.
|
|
500
|
+
- `items` holds more than one entry only for a completion, where the extras are alternatives to cycle through. Each
|
|
501
|
+
item carries its own `command`.
|
|
502
|
+
- A `jump` may carry `targetLine`: the line in the target document to preview, as a word-level diff.
|
|
503
|
+
- `provenance.model` and `provenance.fromCache` describe the first item, and are absent when its provider does not
|
|
504
|
+
report them. `fromCache` means the item was served without a model call.
|
|
505
|
+
|
|
506
|
+
Skip a suggestion whose `kind` or `presentation` you do not recognize, since new values may be added.
|
|
507
|
+
|
|
508
|
+
Report outcomes the way the method behind the `kind` does, passing the item that was shown or accepted. For a
|
|
509
|
+
`completion`, send `textDocument/didShowCompletion` and `textDocument/didPartiallyAcceptCompletion` as described in
|
|
510
|
+
[Inline Completions](#inline-completions). For an `edit` or a `jump`, send `textDocument/didShowInlineEdit` as described
|
|
511
|
+
in [Next Edit Suggestions](#next-edit-suggestions). In every case, call the item's `command` via
|
|
512
|
+
`workspace/executeCommand` after the user accepts it. Next edits returned this way carry no `cacheTelemetryContext`:
|
|
513
|
+
the server caches them itself.
|
|
514
|
+
|
|
424
515
|
## Panel Completions
|
|
425
516
|
|
|
426
517
|
Panel completions are used for "Open Copilot" style completions. They are similar to inline completions, but are shown
|
|
@@ -447,7 +538,9 @@ after accepting to trigger acceptance telemetry. Partial acceptance and shown ev
|
|
|
447
538
|
## Cancellation
|
|
448
539
|
|
|
449
540
|
`textDocument/inlineCompletion` supports cancel-previous strategy for cancellation: If you send new completions
|
|
450
|
-
request, the previous request is cancelled.
|
|
541
|
+
request, the previous request is cancelled. `textDocument/copilotSuggest` requests that ask for completions share this
|
|
542
|
+
strategy with `textDocument/inlineCompletion`, and a superseded one fails with the same `ServerCancelled` error.
|
|
543
|
+
This also applies while the proxy waits for NES after its completion call has finished.
|
|
451
544
|
|
|
452
545
|
Additionally the LSP `$/cancelRequest` method is supported to cancel any request. It is strongly encouraged to eagerly
|
|
453
546
|
cancel completion requests as soon as possible.
|