Skip to content

Commit a8b3f64

Browse files
authored
Merge pull request microsoft#183135 from microsoft/merogge/code-block-help
add code block commands to help menu & hint
2 parents 70fa2da + 4008988 commit a8b3f64

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export function getAccessibilityHelpText(accessor: ServicesAccessor, type: 'chat
2323
if (type === 'chat') {
2424
content.push(descriptionForCommand('chat.action.focus', localize('workbench.action.chat.focus', 'The Focus Chat command ({0}) focuses the chat request/response list, which can be navigated with UpArrow/DownArrow.',), localize('workbench.action.chat.focusNoKb', 'The Focus Chat List command focuses the chat request/response list, which can be navigated with UpArrow/DownArrow and is currently not triggerable by a keybinding.'), keybindingService));
2525
content.push(descriptionForCommand('workbench.action.chat.focusInput', localize('workbench.action.chat.focusInput', 'The Focus Chat Input command ({0}) focuses the input box for chat requests.'), localize('workbench.action.interactiveSession.focusInputNoKb', 'Focus Chat Input command focuses the input box for chat requests and is currently not triggerable by a keybinding.'), keybindingService));
26+
content.push('Chat responses may contain code blocks which can be tabbed to. Use typical editor keybindings to select and copy text. To further interact with these code blocks, run the following commands:');
27+
content.push(descriptionForCommand('workbench.action.chat.insertCodeBlock', localize('workbench.action.chat.insertCodeBlock', 'Insert Code Block ({0}) inserts the code at the current cursor location in last active editor'), localize('workbench.action.chat.insertCodeBlockNoKb', 'Insert Code Block inserts the code at the current cursor location and is currently not triggerable by a keybinding.'), keybindingService));
28+
content.push(descriptionForCommand('workbench.action.chat.insertIntoNewFile', localize('workbench.action.chat.insertIntoNewFile', 'Insert into New File ({0}) creates a new file with the code block as its content'), localize('workbench.action.chat.insertIntoNewFileNoKb', 'Insert into New File creates a new file with the code block as its content and is currently not triggerable by a keybinding.'), keybindingService));
29+
content.push(descriptionForCommand('workbench.action.chat.runInTerminal', localize('workbench.action.chat.runInTerminal', 'Run in Terminal ({0}) runs the code block in the terminal'), localize('workbench.action.chat.runInTerminalNoKb', 'Run in Terminal runs the code block in the terminal and is currently not triggerable by a keybinding.'), keybindingService));
2630
} else {
2731
content.push(localize('interactiveSession.makeRequest', "Tab once to reach the make request button, which will re-run the request."));
2832
const regex = /^(\/fix|\/explain)/;

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { CONTEXT_RESPONSE_HAS_PROVIDER_ID, CONTEXT_RESPONSE_VOTE } from 'vs/work
5858
import { IChatReplyFollowup, IChatService, ISlashCommand, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService';
5959
import { IChatRequestViewModel, IChatResponseViewModel, IChatWelcomeMessageViewModel, isRequestVM, isResponseVM, isWelcomeVM } from 'vs/workbench/contrib/chat/common/chatViewModel';
6060
import { IWordCountResult, getNWords } from 'vs/workbench/contrib/chat/common/chatWordCounter';
61+
import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution';
6162

6263
const $ = dom.$;
6364

@@ -582,6 +583,7 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
582583
@IContextKeyService contextKeyService: IContextKeyService,
583584
@ILanguageService private readonly languageService: ILanguageService,
584585
@IModelService private readonly modelService: IModelService,
586+
@IConfigurationService private readonly _configurationService: IConfigurationService
585587
) {
586588
super();
587589
this.element = $('.interactive-result-editor-wrapper');
@@ -608,7 +610,7 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
608610
scrollbar: {
609611
alwaysConsumeMouseWheel: false
610612
},
611-
ariaLabel: localize('chat.codeBlock', 'Code block'),
613+
ariaLabel: this._configurationService.getValue(AccessibilityVerbositySettingId.Chat) ? localize('chat.codeBlockHelp', 'Code block, to discover ways this can be interacted with, search the command palette for Chat: Insert and Chat: Run.') : localize('chat.codeBlock', 'Code block'),
612614
...this.getEditorOptionsFromConfig()
613615
}, {
614616
isSimpleWidget: true,

0 commit comments

Comments
 (0)