-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor copilot chat participant and add icon (#808)
* refactor: ♻️ update and rename copilot chat participant * add icon * add run command * more docs * more upates * tuned copilot * more docs * avoid duplicate prompt
- Loading branch information
Showing
20 changed files
with
188 additions
and
155 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
docs/genaisrc/image-alt-text.genai.js → docs/genaisrc/image-alt-text.genai.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A screenshot of the chat participant window. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
docs/src/content/docs/reference/vscode/github-copilot-chat.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: GitHub Copilot Chat | ||
sidebar: | ||
order: 3 | ||
--- | ||
|
||
import { Image } from "astro:assets" | ||
import { Code } from "@astrojs/starlight/components" | ||
import scriptSource from "../../../../../../packages/vscode/genaisrc/copilotchat.genai.mjs?raw" | ||
import src from "../../../../assets/chat-participant.png" | ||
import alt from "../../../../assets/chat-participant.png.txt?raw" | ||
|
||
The `@genaiscript` [chat participant](https://code.visualstudio.com/api/extension-guides/chat#parts-of-the-chat-user-experience) lets your run scripts without the context | ||
of a [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) conversation. | ||
This is useful for leverage existing scripts in an interactive chat session. | ||
|
||
<Image src={src} alt={alt} /> | ||
|
||
## Choosing which script to run | ||
|
||
The `/run` command expects a script id as the first argument (e.g., `/run poem`). The rest of the query is | ||
passed to the script as the `env.vars.question` variable. | ||
|
||
```sh | ||
@genaiscript /run summarize | ||
``` | ||
|
||
If you omit the `/run` command, GenAIScript will look for a script named `copilotchat`. If it finds one, it will run it. | ||
Otherwise, it will propose you to create a new script. | ||
|
||
```sh | ||
@genaiscript add comments to the current editor | ||
``` | ||
|
||
## Context | ||
|
||
The context selected by the user in Copilot Chat is converted to variables and passed to the script: | ||
|
||
- the prompt content is passed in `env.vars.question`. The script id is removed in the case of `/run`. | ||
- the current editor text is passed in `env.vars["copilot.editor"]` | ||
- the current editor selection is passed in `env.vars["copilot.selection"]` | ||
- the file references are passed in `env.files` | ||
|
||
## Default script <a id="copilotchat" href="" /> | ||
|
||
The following script can used as a starter template to create the default script when the user does not use the `/run` command. | ||
|
||
<Code | ||
code={scriptSource} | ||
wrap={true} | ||
lang="ts" | ||
title="genaisrc/copilotchat.genai.mts" | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.