Repository navigation
Description
Our Copilot integration departs from the copilot-language-server documentation in several places. Checked against copilot-language-server 1.570.0 (both its bundled main.js and a live stdio session). Line links are to 14c97a7.
Acceptance telemetry is never delivered
assistantDidAcceptCompletion sends workspace/executeCommand through sendNotification, so the message has no id (SessionAssistant.cpp#L2809). The server registers the method only as a request (onRequest(ExecuteCommandRequest.type, ...)), and has no notification handler for it.
In a live session, sending github.copilot.didAcceptCompletionItem with invalid arguments as a request returned a schema-validation error; the same message as a notification produced no response and no log output, so the handler never ran. No acceptance of an inline completion or next edit suggestion reaches Copilot.
window/showMessageRequest is never answered
The README calls support for these requests essential, since they carry account and billing notices. Our handler shows the message text and continues (SessionAssistant.cpp#L2087-L2138); nothing in the module writes a response to a server-initiated request. The actions are dropped, and the server's request stays pending. One example in the bundle: the certificate-error warning offers a "Learn more" action that opens a help page.
Next edit suggestions are reported as shown with the wrong method
Every display branch of showEditSuggestionImpl reports through assistantDidShowCompletion → textDocument/didShowCompletion (TextEditingTargetAssistantHelper.java#L497-L595), including for items returned by textDocument/copilotInlineEdit. The server's didShowCompletion handler looks the id up only in its inline-completion cache and ignores misses; next edit items must be reported with textDocument/didShowInlineEdit.
Discarded next edits are also never reported to Copilot (github.copilot.didIgnoreNextEditSuggestionItem); our dismiss feedback is sent only for Posit AI (TextEditingTargetAssistantHelper.java#L1281-L1294).
Next edit suggestions are reachable with Copilot: assistant_nes_enabled defaults to true and isn't limited to Posit AI.
Open documents are opened twice, the second time from disk
Two mechanisms announce the documents open at agent startup:
- After
initialize,syncOpenDocuments()sendsdidOpenwith each document's editor contents (SessionAssistant.cpp#L1652, added in ensure documents synced when switching agents #16853). - When the agent first reports Running, the frontend calls
assistantRegisterOpenFileswith every open file path (SourceColumnManager.java#L1459, added in Tell Copilot about source files loaded in the IDE before Copilot has started up #16081). On idle,indexFilesends anotherdidOpenfor the same URI and version, with the contents read from disk (SessionAssistant.cpp#L1883-L1913).
LSP doesn't allow a second didOpen without a didClose, and the server's TextDocuments store replaces the document on a repeat open. When a session starts with unsaved edits, the server holds the saved file instead of the buffer, and later incremental didChange ranges apply to the wrong text until the document is closed. (Confirmed from the code paths and the server's handler; not reproduced end to end, which needs a signed-in account.)
Save As leaves the old document open and never opens the new one
Line links in this section and the next are to 360bc5c. Both sections are confirmed from our code paths only; how the server treats the resulting messages was not checked. The code is shared, so they apply to Posit AI as well as Copilot.
The LSP module tracks open documents by URI and doesn't listen for onDocRenamed (SessionLSP.cpp#L419-L424). When a document is saved under a new name:
- No
didCloseis sent for the old URI, so the server keeps that document, with its contents from before the save, until the agent stops. - No
didOpenis sent for the new URI. The save reports its change before writing the document to the source database (SessionSource.cpp#L788-L792), andonDocChangedstarts tracking the new URI as it sendsdidChange(SessionLSP.cpp#L156-L160). TheonDocUpdatedthat follows then finds the URI tracked and skips thedidOpen(SessionLSP.cpp#L205-L214).
didChange, didFocus and completion requests are then sent for a URI the server was never given, and closing the tab sends a didClose for it.
The startup sync and a live open disagree on some R documents
syncOpenDocuments() takes the language ID of a saved R, R Markdown or Quarto document from its extension, and skips the document if the extension isn't in the map (SessionAssistant.cpp#L1901-L1916). The didOpen sent when a document opens while the agent runs uses languageIdFromDocument(), which returns r for all of them (SessionLSP.cpp#L293-L303).
- An R document with an unmapped extension (e.g.
model.q, or a file with no extension set to R) gets nodidOpenfrom the sync after an agent restart, but still getsdidFocus,didChangeand completion requests. - A
.qmddocument is sent asquartoby the sync (SessionLSP.cpp#L90) and asrwhen opened live, so its language depends on whether the agent started before or after it was opened.
Lower priority
didChangeStatusis only logged at debug level; itscommandis ignored, so status notices beyond sign-in (e.g. quota) never reach the user (SessionAssistant.cpp#L2139-L2162).textDocument/inlineCompletionrequests omitformattingOptions(tabSize,insertSpaces) (SessionAssistant.cpp#L2505-L2522).- We never send
$/cancelRequest; the README strongly encourages eager cancellation. Expired continuations are dropped locally without telling the server (SessionAssistant.cpp#L2200-L2215). - Sessions without a project send no workspace folder; the README calls workspace folders highly recommended (SessionAssistant.cpp#L1594-L1610).
Activity