Skip to content

Commit 8ce60b3

Browse files
committed
Merge branch 'main' into vnext
2 parents 9bb5298 + 2eec66c commit 8ce60b3

File tree

18 files changed

+693
-59
lines changed

18 files changed

+693
-59
lines changed

api/extension-guides/chat.md

Lines changed: 148 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ MetaDescription: A guide to creating an AI extension in Visual Studio Code
1111

1212
Visual Studio Code's Copilot Chat architecture enables extension authors to integrate with the [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) experience. A chat extension is a VS Code extension that uses the Chat extension API by contributing a *Chat participant*.
1313

14-
1514
Chat participants are domain experts that can answer user queries within a specific domain. Participants can use different approaches to process a user query:
1615

1716
- Use AI to interpret the request and generate a response, for example by using the [Language Model API](/api/extension-guides/language-model)
@@ -20,13 +19,7 @@ Chat participants are domain experts that can answer user queries within a speci
2019

2120
Participants can use the language model in a wide range of ways. Some participants only make use of the language model to get answers to custom prompts, for example the [sample chat participant](https://github.com/microsoft/vscode-extension-samples/tree/main/chat-sample). Other participants are more advanced and act like [autonomous agents](https://learn.microsoft.com/semantic-kernel/agents/) that invoke multiple tools with the help of the language model. An example of such an advanced participant is the built-in `@workspace` that knows about your workspace and can answer questions about it. Internally, `@workspace` is powered by multiple tools: GitHub's knowledge graph, combined with semantic search, local code indexes, and VS Code's language services.
2221

23-
When a user explicitly mentions a `@participant` in their chat prompt, that prompt is forwarded to the extension that contributed that specific chat participant. The participant then uses a `ResponseStream` to respond to the request. To provide a smooth user experience, the Chat API is streaming-based. A `ResponseStream` can include:
24-
25-
- Markdown for simple text and image responses
26-
- Buttons that invoke VS Code commands
27-
- Progress for longer running operations
28-
- References to URIs or editor locations
29-
- File trees (for example, to show a workspace preview when a chat participant proposes to create a new workspace)
22+
When a user explicitly mentions a `@participant` in their chat prompt, that prompt is forwarded to the extension that contributed that specific chat participant. The participant then uses a `ResponseStream` to respond to the request. To provide a smooth user experience, the Chat API is streaming-based. A chat response can contain rich content, such as Markdown, file trees, command buttons, and more. Get more info about the [supported response output types](#supported-chat-response-output-types).
3023

3124
To help the user take the conversation further, participants can provide *follow-ups* for each response. Follow-up questions are suggestions that are presented in the chat user interface and might give the user inspiration about the chat extension's capabilities.
3225

@@ -36,7 +29,6 @@ Participants can also contribute *commands*, which are a shorthand notation for
3629

3730
Alternatively, it is possible to extend GitHub Copilot by creating a GitHub App that contributes a chat participant in the Chat view. A GitHub App is backed by a service and works across all GitHub Copilot surfaces, such as github.com, Visual Studio, or VS Code. On the other hand, GitHub Apps do not have full access to the VS Code API. To learn more about extending GitHub Copilot through a GitHub App see the [GitHub documentation](https://docs.github.com/en/copilot/building-copilot-extensions/about-building-copilot-extensions).
3831

39-
4032
## Links
4133

4234
- [Chat extension sample](https://github.com/microsoft/vscode-extension-samples/tree/main/chat-sample)
@@ -96,7 +88,7 @@ The first step to create a chat extension is to register it in your `package.jso
9688
}
9789
```
9890

99-
We suggest to use a lowercase `name` to align with existing chat participants. `name` can not contain spaces. Users can then reference the chat participant in the Chat view by using the `@` symbol and the `name` you provided. We suggest to use title case for the `fullName`, which is shown in the title area of a response from your participant. Some participant names are reserved, and in case you use a reserved name VS Code will display the fully qualified name of your participant (including the extension id). The `description` is shown in the chat input field as a placeholder text.
91+
We suggest using a lowercase `name` to align with existing chat participants. `name` can not contain spaces. Users can then reference the chat participant in the Chat view by using the `@` symbol and the `name` you provided. We suggest using title case for the `fullName`, which is shown in the title area of a response from your participant. Some participant names are reserved, and in case you use a reserved name VS Code will display the fully qualified name of your participant (including the extension ID). The `description` is shown in the chat input field as a placeholder text.
10092

10193
The `isSticky` property controls whether the chat participant is persistent, which means that the participant name is automatically prepended in the chat input field after the user has started interacting with the participant.
10294

@@ -202,6 +194,8 @@ stream.button({
202194
});
203195
```
204196

197+
Get more info about the [supported chat response output types](#supported-chat-response-output-types).
198+
205199
In practice, extensions typically send a request to the language model. Once they get a response from the language model, they might further process it, and decide if they should stream anything back to the user. The VS Code Chat API is streaming-based, and is compatible with the streaming [Language Model API](/api/extension-guides/language-model). This allows extensions to report progress and results continuously with the goal of having a smooth user experience. Learn how you can use the [Language Model API](/api/extension-guides/language-model).
206200

207201
#### Use the chat message history
@@ -269,11 +263,154 @@ cat.followupProvider = {
269263

270264
> **Tip:** Follow-ups should be written as questions or directions, not just concise commands.
271265
266+
## Supported chat response output types
267+
268+
To return a response to a chat request, you use the [`ChatResponseStream`](/api/references/vscode-api#ChatResponseStream) parameter on the [`ChatRequestHandler`](/api/references/vscode-api#ChatRequestHandler).
269+
270+
The following list provides the output types for a chat response in the Chat view. A chat response can combine multiple different output types.
271+
272+
- **Markdown**
273+
274+
Render a fragment of Markdown text simple text or images. You can use any Markdown syntax that is part of the [CommonMark](https://commonmark.org/) specification. Use the [`ChatResponseStream.markdown`](/api/references/vscode-api#ChatResponseStream.markdown) method and provide the Markdown text.
275+
276+
Example code snippet:
277+
278+
```typescript
279+
// Render Markdown text
280+
stream.markdown('# This is a title \n');
281+
stream.markdown('This is stylized text that uses _italics_ and **bold**. ');
282+
stream.markdown('This is a [link](https://code.visualstudio.com).\n\n');
283+
stream.markdown('![VS Code](https://code.visualstudio.com/assets/favicon.ico)');
284+
```
285+
286+
- **Code block**
287+
288+
Render a code block that supports IntelliSense, code formatting, and interactive controls to apply the code to the active editor. To show a code block, use the [`ChatResponseStream.markdown`](/api/references/vscode-api#ChatResponseStream.markdown) method and apply the Markdown syntax for code blocks (using backticks).
289+
290+
Example code snippet:
291+
292+
```typescript
293+
// Render a code block that enables users to interact with
294+
stream.markdown('```bash\n');
295+
stream.markdown('```ls -l\n');
296+
stream.markdown('```');
297+
```
298+
299+
- **Command link**
300+
301+
Render a link inline in the chat response that users can select to invoke a VS Code command. To show a command link, use the [`ChatResponseStream.markdown`](/api/references/vscode-api#ChatResponseStream.markdown) method and use the Markdown syntax for links `[link text](command:commandId)`, where you provide the command ID in the URL. For example, the following link opens the Command Palette: `[Command Palette](command:workbench.action.showCommands)`.
302+
303+
To protect against command injection when you load the Markdown text from a service, you have to use a [`vscode.MarkdownString`](/api/references/vscode-api#MarkdownString) object with the `isTrusted` property set to the list of trusted VS Code command IDs. This property is required to enable the command link to work. If the `isTrusted` property is not set or a command is not listed, the command link will not work.
304+
305+
Example code snippet:
306+
307+
```typescript
308+
// Use command URIs to link to commands from Markdown
309+
let markdownCommandString: vscode.MarkdownString = new vscode.MarkdownString(`[Use cat names](command:${CAT_NAMES_COMMAND_ID})`);
310+
markdownCommandString.isTrusted = { enabledCommands: [ CAT_NAMES_COMMAND_ID ] };
311+
312+
stream.markdown(markdownCommandString);
313+
```
314+
315+
If the command takes arguments, you need to first JSON encode the arguments and then encode the JSON string as a URI component. You then append the encoded arguments as a query string to the command link.
316+
317+
```typescript
318+
// Encode the command arguments
319+
const encodedArgs = encodeURIComponent(JSON.stringify(args));
320+
321+
// Use command URIs with arguments to link to commands from Markdown
322+
let markdownCommandString: vscode.MarkdownString = new vscode.MarkdownString(`[Use cat names](command:${CAT_NAMES_COMMAND_ID}?${encodedArgs})`);
323+
markdownCommandString.isTrusted = { enabledCommands: [ CAT_NAMES_COMMAND_ID ] };
324+
325+
stream.markdown(markdownCommandString);
326+
```
327+
328+
- **Command button**
329+
330+
Render a button that invokes a VS Code command. The command can be a built-in command or one that you define in your extension. Use the [`ChatResponseStream.button`](/api/references/vscode-api#ChatResponseStream.button) method and provide the button text and command ID.
331+
332+
Example code snippet:
333+
334+
```typescript
335+
// Render a button to trigger a VS Code command
336+
stream.button({
337+
command: 'my.command',
338+
title: vscode.l10n.t('Run my command')
339+
});
340+
```
341+
342+
- **File tree**
343+
344+
Render a file tree control that lets users preview individual files. For example, to show a workspace preview when proposing to create a new workspace. Use the [`ChatResponseStream.filetree`](/api/references/vscode-api#ChatResponseStream.filetree) method and provide an array of file tree elements and the base location (folder) of the files.
345+
346+
Example code snippet:
347+
348+
```typescript
349+
// Create a file tree instance
350+
var tree: vscode.ChatResponseFileTree[] = [
351+
{ name: 'myworkspace', children: [
352+
{ name: 'README.md' },
353+
{ name: 'app.js' },
354+
{ name: 'package.json' }
355+
]}
356+
];
357+
358+
// Render the file tree control at a base location
359+
stream.filetree(tree, baseLocation);
360+
```
361+
362+
- **Progress message**
363+
364+
Render a progress message during a long-running operation to provide the user with intermediate feedback. For example, to report the completion of each step in a multi-step operation. Use the [`ChatResponseStream.progress`](/api/references/vscode-api#ChatResponseStream.progress) method and provide the message.
365+
366+
Example code snippet:
367+
368+
```typescript
369+
// Render a progress message
370+
stream.progress('Connecting to the database.');
371+
```
372+
373+
- **Reference**
374+
375+
Add a reference for an external URL or editor location in the list references to indicate which information you use as context. Use the [`ChatResponseStream.reference`](/api/references/vscode-api#ChatResponseStream.reference) method and provide the reference location.
376+
377+
Example code snippet:
378+
379+
```typescript
380+
const fileUri: vscode.Uri = vscode.Uri.file('/path/to/workspace/app.js'); // On Windows, the path should be in the format of 'c:\\path\\to\\workspace\\app.js'
381+
const fileRange: vscode.Range = new vscode.Range(0, 0, 3, 0);
382+
const externalUri: vscode.Uri = vscode.Uri.parse('https://code.visualstudio.com');
383+
384+
// Add a reference to an entire file
385+
stream.reference(fileUri);
386+
387+
// Add a reference to a specific selection within a file
388+
stream.reference(new vscode.Location(fileUri, fileRange));
389+
390+
// Add a reference to an external URL
391+
stream.reference(externalUri);
392+
```
393+
394+
- **Inline reference**
395+
396+
Add an inline reference to a URI or editor location. Use the [`ChatResponseStream.anchor`](/api/references/vscode-api#ChatResponseStream.anchor) method and provide the anchor location and optional title. To reference a symbol (for example, a class or variable), you would use a location in an editor.
397+
398+
Example code snippet:
399+
400+
```typescript
401+
const symbolLocation: vscode.Uri = vscode.Uri.parse('location-to-a-symbol');
402+
403+
// Render an inline anchor to a symbol in the workspace
404+
stream.anchor(symbolLocation, 'MySymbol');
405+
```
406+
407+
> **Important**: Images and links are only available when they originate from a domain that is in the trusted domain list. Get more info about [link protection in VS Code](/docs/editor/editingevolved.md#outgoing-link-protection).
408+
272409
## Variables
273410

274411
> **Note:** The Variables API is still in a proposed state and we are actively working on it.
275412

276-
Chat extensions can also contribute chat *variables*, which provide context about the extension's domain. For example, a C++ extension might contribute a variable `#cpp` that would get resolved based on the state of the language service - what C++ version is being used and what C++ programming approach is preferred.
413+
Chat extensions can also contribute chat *variables*, which provide context about the extension's domain. For example, a C++ extension might contribute a variable `#cpp` that would get resolved based on the state of the language service - what C++ version is used and what C++ programming approach is preferred.
277414

278415
Users can refer to a chat variable in a prompt by using the `#` symbol. A variable is resolved by either the chat extension that contributed that variable, or by VS Code when it's a built-in variable (for example, `#file` or `#selection`). VS Code offers the list of registered variables upon typing the `#` symbol in the chat input.
279416

api/references/theme-color.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ Editor Groups are the containers of editors. There can be many editor groups. A
318318
- `tab.unfocusedActiveBorder`: Bottom border for the active tab in an inactive editor group.
319319
- `tab.activeBorderTop`: Top border for the active tab.
320320
- `tab.unfocusedActiveBorderTop`: Top border for the active tab in an inactive editor group
321-
- `tab.dragAndDropBorder`: Border between tabs to indicate that a tab can be inserted between two tabs. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.
322321
- `tab.lastPinnedBorder`: Border on the right of the last pinned editor to separate from unpinned editors.
323322
- `tab.inactiveBackground`: Inactive Tab background color.
324323
- `tab.unfocusedInactiveBackground`: Inactive Tab background color in an unfocused group
@@ -629,7 +628,6 @@ For coloring inserted and removed text, use either a background or a border colo
629628
- `chat.slashCommandForeground`: The foreground color of a chat slash command.
630629
- `chat.avatarBackground`: The background color of a chat avatar.
631630
- `chat.avatarForeground`: The foreground color of a chat avatar.
632-
- `chat.requestBackground`: The background color of a chat request.
633631

634632
## Inline Chat colors
635633

@@ -709,7 +707,6 @@ Peek views are used to show references and declarations as a view inside the edi
709707
- `peekViewEditorGutter.background`: Background color of the gutter in the peek view editor.
710708
- `peekViewEditor.matchHighlightBackground`: Match highlight color in the peek view editor.
711709
- `peekViewEditor.matchHighlightBorder`: Match highlight border color in the peek view editor.
712-
`peekViewEditorStickyScroll.background`: Background color of sticky scroll in the peek view editor.
713710
- `peekViewResult.background`: Background color of the peek view result list.
714711
- `peekViewResult.fileForeground`: Foreground color for file nodes in the peek view result list.
715712
- `peekViewResult.lineForeground`: Foreground color for line nodes in the peek view result list.

docs/azure/aksextensions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 7
2+
Order: 5
33
Area: azure
44
TOCTitle: Azure Kubernetes Service
55
ContentId: 131f9633-5446-4384-96ca-7bff2e3dc0fc

docs/azure/deployment.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 2
2+
Order: 3
33
Area: azure
44
TOCTitle: Deployment
55
PageTitle: Visual Studio Code Azure Tutorials
@@ -9,9 +9,9 @@ DateApproved: 02/1/2024
99
---
1010
# Deploying Applications to Azure
1111

12-
Visual Studio Code makes it easy to deploy your applications to the cloud with [Azure](https://azure.microsoft.com) and we've created walkthroughs to help you get started.
12+
Visual Studio Code makes it easy to deploy your applications to the cloud with Azure and we've created walkthroughs to help you get started.
1313

14-
Whether your workflow is through the [Azure CLI](https://learn.microsoft.com/cli/azure) or [Azure App Service](https://azure.microsoft.com/services/app-service), using a Docker container, or creating serverless [Azure Functions](https://azure.microsoft.com/services/functions/), you'll find the deployment steps you need.
14+
Whether you're a fullstack, backend, API developer, or DevOps engineer, you'll find the deployment steps you need.
1515

1616
## Deployment tutorials
1717

@@ -29,7 +29,6 @@ You can find additional tutorials and walkthroughs on the
2929

3030
## Next steps
3131

32+
* [Deploy to Azure Container Apps](https://learn.microsoft.com/en-us/azure/container-apps/deploy-visual-studio-code) - Run microservices and containerized applications on a serverless platform.
33+
* [Visual Studio Code Azure Extensions](/docs/azure/overview.md) - The Azure Tools extension pack is designed to deploy your application to Azure within minutes.
3234
* [Working with Docker](/docs/azure/docker.md) - Put your application in a Docker container for easy reuse and deployment.
33-
* [Azure Extensions](/docs/azure/extensions.md) - The VS Code Marketplace has hundreds of extensions for Azure and the cloud.
34-
* [Working with MongoDB](/docs/azure/mongodb.md) - Create, manage and query MongoDB databases from within VS Code.
35-
* [Working with Kubernetes](/docs/azure/kubernetes.md) - for automating deployment, scaling, and management of application.

docs/azure/extensions.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)