Skip to content

Test contributable chat context #280380

@alexr00

Description

@alexr00

Refs: #271104

Complexity: 5

Create Issue


This is the first iteration of the contributable chat context API, so there is certainly room for improvement. For this milestone, the goal of testing is to :

  • test that the API works
  • test that the structure of the API makes sense
  • provide feedback on naming or anything else you have feedback on, keeping in mind that this is early API

The ChatContextProvider has 3 ways to provide context. See the provide* methods: https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.chatContextProvider.d.ts#L48-L49

  • Verify that the doc comments for each provide* method make it clear how they are used.
  • Having read about the provide* methods, verify that the doc comments also make it clear what resolveChatContext is used for.

Test provideWorkspaceChatContext:

  • Create an extension, for example with yo code.
  • In your extension activation, register a ChatContextProvider:
    export function registerChatContextProvider(selector: DocumentSelector | undefined, id: string, provider: ChatContextProvider): Disposable;
  • Read the documentation for registerChatContextProvider, and verify that it explains how to make sure your extension is activated for providing context.
  • In your ChatContextProvider, implement provideWorkspaceChatContext, and resolveChatContext. Verify that your workspace chat context is added to chats that you start with Copilot.
  • Implement onDidChangeWorkspaceChatContext and verify that after firing it, your provideWorkspaceChatContext gets called again for the next chat.

Test provideChatContextExplicit:

  • You can use the same extension from the previous step.
  • Implement provideChatContextExplicit in your chat context provider.
  • Verify that your chat context items show when you attach context:
Image

Test provideChatContextForResource:

  • This one is too panful to test from scratch. Instead, you can test it with the latest pre-release version of the GitHub Pull Request extension
  • Make sure you have "chat.implicitContext.suggestedContext": true set.
  • Open a PR webview from the Pull Requests view
  • Ask a question about the PR in chat. Verify that you see that the title of the PR was attached automatically as context
  • Verify that Chat knows things about the PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions