Skip to content

Commit 1d1c28e

Browse files
authored
Cleanup some inline chat debt (microsoft#209009)
* - make inline chat tab-able (fixes microsoft#208569) - fix aria label * - move report issue into widget toolbar - some todo-cleanup * remove unused menuid
1 parent 4b90a20 commit 1d1c28e

File tree

4 files changed

+38
-47
lines changed

4 files changed

+38
-47
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/diffEditor/em
1111
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
1212
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
1313
import { InlineChatController, InlineChatRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
14-
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET_DISCARD, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, MENU_INLINE_CHAT_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES, ACTION_REGENERATE_RESPONSE, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_RESPONSE_FOCUSED, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, InlineChatResponseFeedbackKind, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, MENU_INLINE_CHAT_WIDGET, ACTION_TOGGLE_DIFF } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
14+
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET_DISCARD, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, ACTION_ACCEPT_CHANGES, ACTION_REGENERATE_RESPONSE, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_RESPONSE_FOCUSED, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, InlineChatResponseFeedbackKind, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, MENU_INLINE_CHAT_WIDGET, ACTION_TOGGLE_DIFF } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
1515
import { localize, localize2 } from 'vs/nls';
1616
import { Action2, IAction2Options, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
1717
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@@ -430,8 +430,6 @@ export class ToggleDiffForChange extends AbstractInlineChatAction {
430430
}
431431

432432

433-
434-
435433
export class ReportIssueForBugCommand extends AbstractInlineChatAction {
436434
constructor() {
437435
super({
@@ -440,10 +438,10 @@ export class ReportIssueForBugCommand extends AbstractInlineChatAction {
440438
icon: Codicon.report,
441439
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo(InlineChatResponseTypes.Empty)),
442440
menu: [{
443-
id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
441+
id: MENU_INLINE_CHAT_WIDGET,
444442
when: ContextKeyExpr.and(CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo(InlineChatResponseTypes.Empty)),
445-
group: '2_feedback',
446-
order: 3
443+
group: 'navigation',
444+
order: 2
447445
}]
448446
});
449447
}

src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export interface IInlineChatWidgetConstructionOptions {
8383
/**
8484
* The men that rendered in the lower right corner, use for feedback
8585
*/
86-
feedbackMenuId: MenuId;
86+
feedbackMenuId?: MenuId;
8787

8888
/**
8989
* @deprecated
@@ -157,19 +157,6 @@ export class InlineChatWidget {
157157
@ITextModelService protected readonly _textModelResolverService: ITextModelService,
158158
@IChatService private readonly _chatService: IChatService,
159159
) {
160-
// Share hover delegates between toolbars to support instant hover between both
161-
// TODO@jrieken move into chat widget
162-
// const hoverDelegate = this._store.add(createInstantHoverDelegate());
163-
164-
this._store.add(this._configurationService.onDidChangeConfiguration(e => {
165-
if (e.affectsConfiguration(AccessibilityVerbositySettingId.InlineChat)) {
166-
this._updateAriaLabel();
167-
// TODO@jrieken FIX THIS
168-
// this._chatWidget.ariaLabel = this._accessibleViewService.getOpenAriaHint(AccessibilityVerbositySettingId.InlineChat);
169-
this._elements.followUps.ariaLabel = this._accessibleViewService.getOpenAriaHint(AccessibilityVerbositySettingId.InlineChat);
170-
}
171-
}));
172-
173160
// toolbars
174161
this._progressBar = new ProgressBar(this._elements.progress);
175162
this._store.add(this._progressBar);
@@ -290,14 +277,22 @@ export class InlineChatWidget {
290277
}
291278
};
292279

293-
const feedbackToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.feedbackToolbar, options.feedbackMenuId, { ...workbenchToolbarOptions, hiddenItemStrategy: HiddenItemStrategy.Ignore });
294-
this._store.add(feedbackToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
295-
this._store.add(feedbackToolbar);
280+
if (options.feedbackMenuId) {
281+
const feedbackToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.feedbackToolbar, options.feedbackMenuId, { ...workbenchToolbarOptions, hiddenItemStrategy: HiddenItemStrategy.Ignore });
282+
this._store.add(feedbackToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
283+
this._store.add(feedbackToolbar);
284+
}
296285

286+
this._store.add(this._configurationService.onDidChangeConfiguration(e => {
287+
if (e.affectsConfiguration(AccessibilityVerbositySettingId.InlineChat)) {
288+
this._updateAriaLabel();
289+
}
290+
}));
297291

292+
this._elements.root.tabIndex = 0;
298293
this._elements.followUps.tabIndex = 0;
299-
this._elements.followUps.ariaLabel = this._accessibleViewService.getOpenAriaHint(AccessibilityVerbositySettingId.InlineChat);
300294
this._elements.statusLabel.tabIndex = 0;
295+
this._updateAriaLabel();
301296

302297
// this._elements.status
303298
this._store.add(setupCustomHover(getDefaultHoverDelegate('element'), this._elements.statusLabel, () => {
@@ -319,15 +314,19 @@ export class InlineChatWidget {
319314
}
320315

321316
private _updateAriaLabel(): void {
322-
if (!this._accessibilityService.isScreenReaderOptimized()) {
323-
return;
324-
}
325-
let label = defaultAriaLabel;
326-
if (this._configurationService.getValue<boolean>(AccessibilityVerbositySettingId.InlineChat)) {
327-
const kbLabel = this._keybindingService.lookupKeybinding(AccessibilityCommandId.OpenAccessibilityHelp)?.getLabel();
328-
label = kbLabel ? localize('inlineChat.accessibilityHelp', "Inline Chat Input, Use {0} for Inline Chat Accessibility Help.", kbLabel) : localize('inlineChat.accessibilityHelpNoKb', "Inline Chat Input, Run the Inline Chat Accessibility Help command for more information.");
317+
318+
this._elements.root.ariaLabel = this._accessibleViewService.getOpenAriaHint(AccessibilityVerbositySettingId.InlineChat);
319+
320+
if (this._accessibilityService.isScreenReaderOptimized()) {
321+
let label = defaultAriaLabel;
322+
if (this._configurationService.getValue<boolean>(AccessibilityVerbositySettingId.InlineChat)) {
323+
const kbLabel = this._keybindingService.lookupKeybinding(AccessibilityCommandId.OpenAccessibilityHelp)?.getLabel();
324+
label = kbLabel
325+
? localize('inlineChat.accessibilityHelp', "Inline Chat Input, Use {0} for Inline Chat Accessibility Help.", kbLabel)
326+
: localize('inlineChat.accessibilityHelpNoKb', "Inline Chat Input, Run the Inline Chat Accessibility Help command for more information.");
327+
}
328+
this._chatWidget.inputEditor.updateOptions({ ariaLabel: label });
329329
}
330-
this._chatWidget.inputEditor.updateOptions({ ariaLabel: label });
331330
}
332331

333332
dispose(): void {
@@ -526,7 +525,9 @@ export class InlineChatWidget {
526525
}
527526
};
528527
}
529-
528+
/**
529+
* @deprecated use `setChatModel` instead
530+
*/
530531
updateFollowUps(items: IInlineChatFollowup[], onFollowup: (followup: IInlineChatFollowup) => void): void;
531532
updateFollowUps(items: undefined): void;
532533
updateFollowUps(items: IInlineChatFollowup[] | undefined, onFollowup?: ((followup: IInlineChatFollowup) => void)) {
@@ -540,10 +541,11 @@ export class InlineChatWidget {
540541
this._onDidChangeHeight.fire();
541542
}
542543

543-
544+
/**
545+
* @deprecated use `setChatModel` instead
546+
*/
544547
updateSlashCommands(commands: IInlineChatSlashCommand[]) {
545-
// this._inputWidget.updateSlashCommands(commands);
546-
// TODO@jrieken
548+
547549
}
548550

549551
updateInfo(message: string): void {

src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5-
import { Dimension, addDisposableListener } from 'vs/base/browser/dom';
5+
import { Dimension } from 'vs/base/browser/dom';
66
import * as aria from 'vs/base/browser/ui/aria/aria';
77
import { toDisposable } from 'vs/base/common/lifecycle';
88
import { assertType } from 'vs/base/common/types';
@@ -14,7 +14,7 @@ import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
1414
import { localize } from 'vs/nls';
1515
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
1616
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
17-
import { ACTION_ACCEPT_CHANGES, ACTION_REGENERATE_RESPONSE, ACTION_TOGGLE_DIFF, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_FEEDBACK, MENU_INLINE_CHAT_WIDGET_STATUS } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
17+
import { ACTION_ACCEPT_CHANGES, ACTION_REGENERATE_RESPONSE, ACTION_TOGGLE_DIFF, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_STATUS } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
1818
import { EditorBasedInlineChatWidget } from './inlineChatWidget';
1919
import { MenuId } from 'vs/platform/actions/common/actions';
2020

@@ -44,7 +44,6 @@ export class InlineChatZoneWidget extends ZoneWidget {
4444
telemetrySource: 'interactiveEditorWidget-toolbar',
4545
inputMenuId: MenuId.ChatExecute,
4646
widgetMenuId: MENU_INLINE_CHAT_WIDGET,
47-
feedbackMenuId: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
4847
statusMenuId: {
4948
menu: MENU_INLINE_CHAT_WIDGET_STATUS,
5049
options: {
@@ -69,13 +68,6 @@ export class InlineChatZoneWidget extends ZoneWidget {
6968
this._disposables.add(this.widget);
7069
this.create();
7170

72-
73-
this._disposables.add(addDisposableListener(this.domNode, 'click', e => {
74-
if (!this.widget.hasFocus()) {
75-
this.widget.focus();
76-
}
77-
}, true));
78-
7971
// todo@jrieken listen ONLY when showing
8072
const updateCursorIsAboveContextKey = () => {
8173
if (!this.position || !this.editor.hasModel()) {

src/vs/workbench/contrib/inlineChat/common/inlineChat.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ export const ACTION_TOGGLE_DIFF = 'inlineChat.toggleDiff';
182182

183183
export const MENU_INLINE_CHAT_WIDGET = MenuId.for('inlineChatWidget');
184184
export const MENU_INLINE_CHAT_WIDGET_STATUS = MenuId.for('inlineChatWidget.status');
185-
export const MENU_INLINE_CHAT_WIDGET_FEEDBACK = MenuId.for('inlineChatWidget.feedback');
186185
export const MENU_INLINE_CHAT_WIDGET_DISCARD = MenuId.for('inlineChatWidget.undo');
187186

188187
// --- colors

0 commit comments

Comments
 (0)