Open mjbvz opened 1 month ago
Tagging @arkalyanms on this ask.
vscode-chat-code-block
documents. These documents get added to the misc workspace@workspace
contents work (the requests execute on the underlying document URI which goes to the main workspace).@workspace
blocks is not working. Requests are being made, but they're given a special URI that we don't know how to map to anything
"uri": "vscode-chat-code-block://d0fa33c0-7600-4ec0-8c04-a34236adf0b6/response_9/0#{\"references\":[{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\.vscode\\\\tasks_old.json\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/.vscode/tasks_old.json\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/.vscode/tasks_old.json\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":19,\"endColumn\":2}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\BinarySearch.cs\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/BinarySearch.cs\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/BinarySearch.cs\",\"scheme\":\"file\"}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\ConsoleAppNet9.csproj\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/ConsoleAppNet9.csproj\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/ConsoleAppNet9.csproj\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":10,\"endColumn\":11}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\ConsoleAppNet9.csproj.nuget.g.targets\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/ConsoleAppNet9.csproj.nuget.g.targets\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/ConsoleAppNet9.csproj.nuget.g.targets\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":2,\"endColumn\":92}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.AssemblyInfoInputs.cache\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.AssemblyInfoInputs.cache\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.AssemblyInfoInputs.cache\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":1,\"endColumn\":65}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.csproj.CoreCompileInputs.cache\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.CoreCompileInputs.cache\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.CoreCompileInputs.cache\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":1,\"endColumn\":65}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.csproj.FileListAbsolute.txt\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.FileListAbsolute.txt\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.FileListAbsolute.txt\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":14,\"endColumn\":86}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.GlobalUsings.g.cs\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.GlobalUsings.g.cs\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.GlobalUsings.g.cs\",\"scheme\":\"file\"}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\Program.cs\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/Program.cs\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/Program.cs\",\"scheme\":\"file\"}}]}"
@workspace
context requests (see below with the chat window URI but references to all classes).(cc @mjbvz )
c#
is annoying. It is the worst when the c#
word is the last thing to type, as hitting enter will autocomplete the suggestion, instead of submitting the request to copilot.
Inspect Editor Tokens and Scopes
command for chat window code blocks? Would be useful to see the classifications.@workspace
requests? Instead of what appears to be a special vscode-chat-code-block
uri with extra references? Similar to how the hover/gtd requests work? Sample JSON
[Trace - 1:47:01 PM] Sending request 'textDocument/semanticTokens/range - (53)'.
Params: {
"textDocument": {
"uri": "vscode-chat-code-block://d0fa33c0-7600-4ec0-8c04-a34236adf0b6/response_11/0#{\"references\":[{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\.vscode\\\\tasks_old.json\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/.vscode/tasks_old.json\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/.vscode/tasks_old.json\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":19,\"endColumn\":2}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\BinarySearch.cs\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/BinarySearch.cs\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/BinarySearch.cs\",\"scheme\":\"file\"}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\ConsoleAppNet9.csproj\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/ConsoleAppNet9.csproj\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/ConsoleAppNet9.csproj\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":10,\"endColumn\":11}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\ConsoleAppNet9.csproj.nuget.g.targets\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/ConsoleAppNet9.csproj.nuget.g.targets\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/ConsoleAppNet9.csproj.nuget.g.targets\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":2,\"endColumn\":92}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.AssemblyInfoInputs.cache\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.AssemblyInfoInputs.cache\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.AssemblyInfoInputs.cache\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":1,\"endColumn\":65}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.csproj.CoreCompileInputs.cache\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.CoreCompileInputs.cache\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.CoreCompileInputs.cache\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":1,\"endColumn\":65}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.csproj.FileListAbsolute.txt\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.FileListAbsolute.txt\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.csproj.FileListAbsolute.txt\",\"scheme\":\"file\"},\"range\":{\"startLineNumber\":1,\"startColumn\":1,\"endLineNumber\":14,\"endColumn\":86}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\obj\\\\Debug\\\\net9.0\\\\ConsoleAppNet9.GlobalUsings.g.cs\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.GlobalUsings.g.cs\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/obj/Debug/net9.0/ConsoleAppNet9.GlobalUsings.g.cs\",\"scheme\":\"file\"}},{\"uri\":{\"$mid\":1,\"fsPath\":\"c:\\\\Users\\\\dabarbet\\\\source\\\\repos\\\\ConsoleAppNet9\\\\Program.cs\",\"_sep\":1,\"external\":\"file:///c%3A/Users/dabarbet/source/repos/ConsoleAppNet9/Program.cs\",\"path\":\"/c:/Users/dabarbet/source/repos/ConsoleAppNet9/Program.cs\",\"scheme\":\"file\"}}]}"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 43,
"character": 1
}
}
}
Thanks for testing! Sounds pretty good overall! Library intellisense is probably the top priority in terms of user impact
For the VS Code asks:
Should already be fixed https://github.com/microsoft/vscode/issues/216757
This sounds expected. You should see the same vscode-chat-code-block
doc used for hover
and other requests too in the purely local cases
Opened https://github.com/microsoft/vscode/issues/227641. Less sure about this one as code lenses are visually more heavy weight
Feel free to open any additional issues directly against VS Code and ping me on them
Thanks!
This sounds expected. You should see the same vscode-chat-code-block doc used for hover and other requests too in the purely local cases
@mjbvz For this one - when the chat block was from a workspace file, for Go to def and hover I was getting LSP requests for the actual workspace document URI (not the vscode-chat-code-block
). Whereas only the semantic tokens request had the vscode-chat-block
URI instead of the workspace URI.
@dibarbet Is it possible your extension / language server hasn't registered to support that document scheme for hover/go to def?
I just confirmed that for JS/TS, the go to def requests go to vscode-chat-code-block
(ignore the ^
at the start):
What should happen on go to def
:
The language extension is asked for a local definition in the vscode-chat-code-block
document
If none is found, then we fall back to trying to resolve the symbol from the @workspace
context. This is handled by copilot but may trigger a go to def
request in one of the actual workspace files
@mjbvz ah you're correct - it was the fallback request that uses the document URI from the workspace (for go to def and hover). The request for the vscode-chat-code-block
returned nothing for those features, so the fallback got called. That is why they were working.
It looks like semantic tokens doesn't do the same fallback request because we return tokens for the initial request (just incorrect ones). Apologies for the misunderstanding there. We'll have to figure out if we can answer the semantic tokens request on the original URI or if we should return nothing and allow the fallback to be invoked.
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 your team's help testing out C# 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 C# extension should see
TextDocuments
for each chat code blockThese documents will have the scheme
vscode-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 C#
, there should be a single code block that has these IntelliSense featuresTest cross code block IntelliSense
Ask a questions such as
binary search in C#
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 C# 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