The textDocument/copilotInlineEdit method retrieves "next edit" suggestions. These are inline completions that may include deletions or modifications to existing text and are not necessarily positioned at the cursor. This is a separate method from standard inline completions to allow for feature opting and distinction.
Request Parameters
The request uses parameters similar to TextDocumentPositionParams but requires a textDocument.version field (a VersionedTextDocumentIdentifier).
Response Format
The response contains an edits array. Each edit includes a command object. To trigger acceptance telemetry, the client must call the command via workspace/executeCommand after the user accepts the edit.
// Request
{
"textDocument": {
"uri": "file:///path/to/file",
"version": 0
},
"position": {"line": 1, "character": 2}
}
// Response
{
"edits": [
{
"text": "an edit suggestion",
"textDocument": {
"uri": "file:///path/to/file",
"version": 0
},
"range": {
"start": {"line": 1, "character": 0},
"end": {"line": 1, "character": 5}
},
"command": {
"title": "Accept inline edit",
"command": "github.copilot.didAcceptCompletionItem",
"arguments": ["some-id"]
}
}
]
}