Open mjbvz opened 2 weeks ago
I'm wondering if our import resolution is going to work. The schema will make us think the file is not on the local file system, so we won't search the workspace. We might have to special case the schema here.
default workspace
might work with stdlib
with any random url
in async
server. but that said, feels like it might be better to just create new workspace that deals with copilot specifically? like copilotWorkspace
? and we enable or disable certain features there?
next week I'll try to look more deeply into this, since right now we only support vscode-chat-code-block
and I was struggling to get a Pylance build with vscode-copilot-chat-code-block
and I'm not sure why.
But so far I noticed that when Copilot uses one of the workspace files as reference, go to def and hover works as expected. With reference:
No reference (nothing shows when hovering models)
Also noticed that go to definition on .models takes to the Django built-in models module, not my models.py file. But the classes go to the models.py as expected:
Errors are not being displayed indeed, although a few diagnostics such as unaccessed symbol or unreachable code are displayed (note that the "experimental pylance" string is a known bug that has just recently been fixed):
Apart from that, everything else worked well: bracket matching, smart selection, go to def on global variables, response results not showing on symbol search
This is an open ended, exploratory item
VS Code recently enabled intellisense in copilot chat code blocks. Although this is mostly implemented in a language agnostic way, language extensions may need to make some changes to get the best support
For this exploration, I'd like the python team's help testing out IntelliSense in copilot chat code blocks. I've provided a list of ideas on what to test below, however feel free to build on it. I've gone through them for JS/TS and found them to be a good starting point. You can also file feature request against VS Code for new feature ideas
Areas to test
The Python extension should see
TextDocuments
for each chat code blockThere will actually be two docs per code block, one with the scheme
vscode-chat-code-block:
and one with the schemevscode-copilot-chat-code-block:
.vscode-chat-code-block
is the scheme used by VS Code core to provide basic intellisense (such as expand selection.vscode-copilot-chat-code-block
is the scheme used by copilot to provide go to definition support. This is needed because copilot registers itself as the go to def provider forvscode-chat-code-block
Basic syntax language features — such bracket matching and Smart Selection — should always work
You should never see errors reported for code in chat code blocks
Try asking copilot to generate invalid code to confirm this
Test hovers and go to definition within a single code block
For example if you ask for
binary search in python
, there should be a single code block that has these IntelliSense featuresTest cross code block IntelliSense
Ask a questions such as
binary search in python
and follow up by askingwrite some tests for it
. The second code block should use the binary search function defined in the first. Inside of the second code block you should be able to hover on it to see documentation and usego to definition
on itTest IntelliSense for workspace symbols
This feature is mostly handled by copilot but still worth testing. For it, as a
@workspace
question to find code in the workspace. For example,@workspace where's the code for binary search
hover
,go to definition
,go to implementation
, andgo to type definition
for symbols that come from the workspaceMake sure that code in code blocks is never picked up as a reference
If a code block uses a global symbol for example, when you run
find all references
on that symbol in a normal workspace file, you should not see the use in the code block listedMake sure symbols code blocks never shows up in workspace symbol search
Explore any python specific features/behavior of these IntelliSense features inside these chat code blocks
Think about if there's any additional IntelliSense features that would help users understand code inside of chat code blocks