File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,19 @@ The following list provides the output types for a chat response in the Chat vie
312
312
stream.markdown(markdownCommandString);
313
313
` ` `
314
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
+
315
328
- ** Command button **
316
329
317
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 .
You can’t perform that action at this time.
0 commit comments