You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VS Code recently enabled IntelliSense in copilot chat code blocks. Although this is mostly implemented in a language agnostic way, the C++ extension needs to make some changes to support this new format.
Initially looking into it, I see a few barriers to this working by default.
-- we will usually bail out early if scheme is not "file" in some event handlers that we would want to support.
-- we get most document/editor events for the code block, but it looks like we're not getting "didOpen" which we rely on to set up file context.
-- document.uri.scheme === "vscode-chat-code-block" && document.languageId === "cpp"
Tips from vscode-copilot:
Areas to test
The C++ extension should see TextDocuments for each chat code block
There will actually be two docs per code block, one with the scheme vscode-chat-code-block: and one with the scheme vscode-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 for 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 features
Make sure these features work for global symbols
Also test IntelliSense for symbols defined within the block
Check that any special c++ features in hovers (such as links) work as expected
Make sure the code block IntelliSense observes any relevant workspace/project settings
Test cross code block IntelliSense
Ask a questions such as binary search in c++ and follow up by asking write 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 use go to definition on it
Test 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
Make sure can use hover, go to definition, go to implementation, and go to type definition for symbols that come from the workspace
Make sure you can still use these features for globals and locals too
Make 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 listed
Make 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
The text was updated successfully, but these errors were encountered:
Feature Request
VS Code recently enabled IntelliSense in copilot chat code blocks. Although this is mostly implemented in a language agnostic way, the C++ extension needs to make some changes to support this new format.
This is currently also being tracked for Python and Java (and built in by default for JS/TS):
microsoft/pylance-release#6008
redhat-developer/vscode-java#3684
Initially looking into it, I see a few barriers to this working by default.
-- we will usually bail out early if scheme is not "file" in some event handlers that we would want to support.
-- we get most document/editor events for the code block, but it looks like we're not getting "didOpen" which we rely on to set up file context.
-- document.uri.scheme === "vscode-chat-code-block" && document.languageId === "cpp"
Tips from vscode-copilot:
Areas to test
The C++ extension should see TextDocuments for each chat code block
There will actually be two docs per code block, one with the scheme vscode-chat-code-block: and one with the scheme vscode-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 for 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 features
Make sure these features work for global symbols
Also test IntelliSense for symbols defined within the block
Check that any special c++ features in hovers (such as links) work as expected
Make sure the code block IntelliSense observes any relevant workspace/project settings
Test cross code block IntelliSense
Ask a questions such as binary search in c++ and follow up by asking write 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 use go to definition on it
Test 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
Make sure can use hover, go to definition, go to implementation, and go to type definition for symbols that come from the workspace
Make sure you can still use these features for globals and locals too
Make 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 listed
Make 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
The text was updated successfully, but these errors were encountered: