-
Notifications
You must be signed in to change notification settings - Fork 114
assistant: fix copilot inline completions for ipynb #8498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
E2E Tests 🚀 |
return true; // No glob patterns configured, so completions are enabled | ||
} | ||
|
||
// Check all of the glob patterns and return true if any match | ||
// Check all of the glob patterns and return false if any match | ||
for (const pattern of globPattern) { | ||
if (glob.match(pattern, uri.path)) { | ||
return true; // File matches an exclusion pattern | ||
return false; // File matches an exclusion pattern, so it is excluded from completions | ||
} | ||
} | ||
|
||
return false; // No patterns matched, so the file is not excluded | ||
return true; // No patterns matched, so completions are enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I saw the name of the function areCompletionsEnabled
, I expected the function to return true when no globs are provided or matched, but this was returning the opposite.
I inverted the logic here so that the returned value aligns with the function name. Somehow, this seems to resolve the issue with ipynb?? 🧐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't get completions in notebooks. It logs an error in the console about the file URI.
ERR Document for URI could not be found: vscode-notebook-cell:/Users/tmok/source/test/Python/notebook.ipynb#W0sZmlsZQ%3D%3D: Error: Document for URI could not be found: vscode-notebook-cell:/Users/tmok/source/test/Python/notebook.ipynb#W0sZmlsZQ%3D%3D
Ah I see this error too, but I was signed into both Copilot and Gemini for completions. The completions appeared to work for me, but actually Copilot completions are not working, while Gemini completions seem to be all good. Investigating the Copilot completions issue... 🔎 |
This requires more involved investigation than initially thought. I'm going to pause on this while I take a look at some higher priority items. Kicking to Draft -- I'll let you know when this is ready again. Some notes in the meantime:
Console logs with some notes from myself and Wasim (ty!) // debug print right after line 236
*** debug log *** inlineCompletion params: {"context":{"triggerKind":1},"textDocument":{"uri":"vscode-notebook-cell:/Users/sashimi/qa-example-content/workspaces/large_py_notebook/spotify.ipynb#W0sZmlsZQ%3D%3D"},"position":{"line":12,"character":4}} (at console.<anonymous> (file:///Users/sashimi/dev/positron-dev/out/vs/workbench/api/common/extHostConsoleForwarder.js:45:22))
log.ts:464
// error message at line 237, we don't get to a debug print right after line 237
ERR Document for URI could not be found: vscode-notebook-cell:/Users/sashimi/qa-example-content/workspaces/large_py_notebook/spotify.ipynb#W0sZmlsZQ%3D%3D: Error: Document for URI could not be found: vscode-notebook-cell:/Users/sashimi/qa-example-content/workspaces/large_py_notebook/spotify.ipynb#W0sZmlsZQ%3D%3D
at handleResponse (/Users/sashimi/dev/positron-dev/extensions/positron-assistant/node_modules/vscode-jsonrpc/lib/common/connection.js:565:48)
at handleMessage (/Users/sashimi/dev/positron-dev/extensions/positron-assistant/node_modules/vscode-jsonrpc/lib/common/connection.js:345:13)
at processMessageQueue (/Users/sashimi/dev/positron-dev/extensions/positron-assistant/node_modules/vscode-jsonrpc/lib/common/connection.js:362:17)
at Immediate.<anonymous> (/Users/sashimi/dev/positron-dev/extensions/positron-assistant/node_modules/vscode-jsonrpc/lib/common/connection.js:334:13)
at process.processImmediate (node:internal/timers:483:21)
at process.callbackTrampoline (node:internal/async_hooks:130:17)
// sometimes this error occurs instead of `ERR Document for URI could not be found`
ERR Schema validation failed with the following errors:
- /context/selectedCompletionInfo/range: Expected object
- : Expected all values to match: Error: Schema validation failed with the following errors:
- /context/selectedCompletionInfo/range: Expected object
- : Expected all values to match
|
This PR continues @sharon-wang's work in #8498 to add basic inline completions in notebooks (#8061), which also works by default in Positron notebooks (#8734). The Copilot language server advertises that it supports notebooks (in the initialize result) which causes vscode-languageclient to send notebookDocument/did* notifications instead of textDocument/did* notifications. Servers are expected to create the text documents referenced in the notebook document, however, the Copilot server doesn't seem to do that, causing "document not found" errors. This PR adds language client middleware that intercepts notebookDocument/did* notifications and sends textDocument/did* notifications for each affected cell. The current implementation treats each cell independently, so the server will be aware of all cells in a notebook, but not their structure, kind, outputs, etc. ### Release Notes #### New Features - Assistant: Copilot inline completions are now available in Jupyter notebooks #### Bug Fixes - N/A ### QA Notes via @sharon-wang: @:assistant * inline completions should be available for ipynb files when authenticated with GitHub Copilot * the `positron.assistant.inlineCompletionExcludes` setting should continue to work --------- Co-authored-by: sharon wang <[email protected]>
This work was added via #9115! Closing this. |
Summary
Release Notes
Note
TBD if this is a feature or a bugfix 😆
New Features
ipynb
files (Assistant: Copilot completions support in ipynb files #8061)Bug Fixes
ipynb
files (Assistant: Copilot completions support in ipynb files #8061)QA Notes
@:assistant
positron.assistant.inlineCompletionExcludes
setting should continue to work