Skip to content

Commit 74d1f59

Browse files
authored
Merge pull request microsoft#184943 from microsoft/merogge/inline-help-improvement
2 parents ca3c346 + 22a4944 commit 74d1f59

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

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

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,30 @@ import { withNullAsUndefined } from 'vs/base/common/types';
1010
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
1111
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
1212
import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat';
13-
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
14-
import { EditMode } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
1513
import { IAccessibleViewService } from 'vs/workbench/contrib/accessibility/browser/accessibleView';
1614
import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
1715

18-
export function getAccessibilityHelpText(accessor: ServicesAccessor, type: 'chat' | 'inline', currentInput?: string): string {
16+
export function getAccessibilityHelpText(accessor: ServicesAccessor, type: 'chat' | 'inline'): string {
1917
const keybindingService = accessor.get(IKeybindingService);
20-
const configurationService = accessor.get(IConfigurationService);
2118
const content = [];
2219
if (type === 'chat') {
2320
content.push(localize('chat.overview', 'Chat responses will be announced as they come in. A response will indicate the number of code blocks, if any, and then the rest of the response.'));
24-
content.push(localize('chat.requestHistory', 'In the input box, use UpArrow/DownArrow to navigate your request history. Edit input and use enter to run a new request.'));
21+
content.push(localize('chat.requestHistory', 'In the input box, use up and down arrows to navigate your request history. Edit input and use enter to run a new request.'));
2522
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));
2623
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));
2724
content.push(descriptionForCommand('workbench.action.chat.nextCodeBlock', localize('workbench.action.chat.nextCodeBlock', 'The Chat: Next Code Block command ({0}) focuses the next code block within a response.'), localize('workbench.action.chat.nextCodeBlockNoKb', 'The Chat: Next Code Block command focuses the next code block within a response and is currently not triggerable by a keybinding.'), keybindingService));
2825
content.push(descriptionForCommand('workbench.action.chat.clear', localize('workbench.action.chat.clear', 'The Chat Clear command ({0}) clears the request/response list.'), localize('workbench.action.chat.clearNoKb', 'The Chat Clear command clears the request/response list and is currently not triggerable by a keybinding.'), keybindingService));
2926
} else {
30-
content.push(localize('inlineChat.makeRequest', "Tab once to reach the make request button, which will re-run the request."));
31-
const regex = /^(\/fix|\/explain)/;
32-
const match = currentInput?.match(regex);
33-
const command = match && match.length ? match[0].substring(1) : undefined;
34-
if (command === 'fix') {
35-
const editMode = configurationService.getValue('inlineChat.mode');
36-
if (editMode === EditMode.Preview) {
37-
const keybinding = keybindingService.lookupKeybinding('editor.action.diffReview.next')?.getAriaLabel();
38-
content.push(keybinding ? localize('inlineChat.diff', "Tab again to enter the Diff editor with the changes and enter review mode with ({0}). Use Up/DownArrow to navigate lines with the proposed changes.", keybinding) : localize('inlineChat.diffNoKb', "Tab again to enter the Diff editor with the changes and enter review mode with the Go to Next Difference Command. Use Up/DownArrow to navigate lines with the proposed changes."));
39-
content.push(localize('inlineChat.acceptReject', "Tab again to reach the action bar, which can be navigated with Left/RightArrow."));
40-
}
41-
} else if (command === 'explain') {
42-
content.push(localize('inlineChat.explain', "/explain commands will be run in the chat view."));
43-
content.push(localize('inlineChat.chatViewFocus', "To focus the chat view, run the GitHub Copilot: Focus on GitHub Copilot View command, which will focus the input box."));
44-
} else {
45-
content.push(localize('inlineChat.toolbar', "Use tab to reach conditional parts like commands, status message, message responses and more."));
46-
}
27+
const startChatKeybinding = keybindingService.lookupKeybinding('inlineChat.start')?.getAriaLabel();
28+
content.push(localize('inlineChat.overview', "Inline chat occurs within a code editor and takes into account current selection. It is useful for refactoring, fixing, and more. Keep in mind that Copilot generated code may be incorrect."));
29+
content.push(localize('inlineChat.access', "It can be activated via the Fix and Explain with Copilot context menu actions or directly using the command: Inline Chat: Start Code Chat ({0}).", startChatKeybinding));
30+
content.push(localize('chat.requestHistoryInline', 'In the input box, use up and down arrows to navigate your request history. Edit input and use enter or the make request button to run a new request.'));
31+
content.push(localize('inlineChat.contextActions', "Explain and Fix with Copilot actions run a request prefixed with /fix or /explain. These prefixes can be used directly in the input box to apply those specific actions."));
32+
content.push(localize('inlineChat.fix', "When a request is prefixed with /fix, a response will indicate the problem with the current code. A diff editor will be rendered and can be reached by tabbing."));
33+
const diffReviewKeybinding = keybindingService.lookupKeybinding('editor.action.diffReview.next')?.getAriaLabel();
34+
content.push(diffReviewKeybinding ? localize('inlineChat.diff', "Once in the diff editor, enter review mode with ({0}). Use up and down arrows to navigate lines with the proposed changes.", diffReviewKeybinding) : localize('inlineChat.diffNoKb', "Tab again to enter the Diff editor with the changes and enter review mode with the Go to Next Difference Command. Use Up/DownArrow to navigate lines with the proposed changes."));
35+
content.push(localize('inlineChat.explain', "When a request is prefixed with /explain, a response will explain the code in the current selection and the chat view will be focused."));
36+
content.push(localize('inlineChat.toolbar', "Use tab to reach conditional parts like commands, status, message responses and more."));
4737
}
4838
return content.join('\n');
4939
}
@@ -70,10 +60,9 @@ export async function runAccessibilityHelpAction(accessor: ServicesAccessor, edi
7060
return;
7161
}
7262

73-
const cachedInput = inputEditor.getValue();
7463
const cachedPosition = inputEditor.getPosition();
7564
inputEditor.getSupportedActions();
76-
const helpText = getAccessibilityHelpText(accessor, type, type === 'inline' ? cachedInput : undefined);
65+
const helpText = getAccessibilityHelpText(accessor, type);
7766
const provider = accessibleViewService.registerProvider({
7867
id: type,
7968
provideContent: () => helpText,

0 commit comments

Comments
 (0)