Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/vs/sessions/contrib/chat/browser/media/chatWidget.css
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@
font-size: var(--vscode-codiconFontSize);
}

.sessions-chat-picker-slot.sessions-workspace-category-picker-slot .action-label > .sessions-chat-dropdown-chevron {
font-size: var(--vscode-codiconFontSize-compact);
}

.sessions-workspace-category-picker .sessions-chat-dropdown-label {
margin-left: 0;
}
Expand Down
2 changes: 0 additions & 2 deletions src/vs/sessions/contrib/chat/browser/newChatWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ export class NewChatWidget extends Disposable {
loading,
historyKey: constObservable(undefined), // no persisted history for the new-session view
placeholder: localize('newSessionPromptPlaceholder', "Pitch your idea"),
sessionTypePickerOptions: { showChevron: false },
supportsBackground: true,
deferredNotificationsEnabled,
petHostPreferred: this.options.petHostPreferred,
Expand Down Expand Up @@ -707,7 +706,6 @@ export class NewChatWidget extends Disposable {
label: localize('newSessionWorkspacePicker.githubContext', "Issue/PR"),
ariaLabel: localize('newSessionWorkspacePicker.githubContextAriaLabel', "Attach a GitHub issue or pull request to the new session"),
tooltip: localize('newSessionWorkspacePicker.githubContextTooltip', "Attach an issue or pull request as context"),
icon: Codicon.add,
hideIconWhenAttached: true,
group: SESSION_WORKSPACE_GROUP_GITHUB,
attachesContext: true,
Expand Down
11 changes: 9 additions & 2 deletions src/vs/sessions/contrib/chat/browser/sessionWorkspacePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export interface IWorkspacePickerTrigger {
readonly label?: string;
readonly ariaLabel: string;
readonly tooltip?: string;
readonly icon: ThemeIcon;
readonly icon?: ThemeIcon;
readonly hideIconWhenAttached?: boolean;
readonly reflectsWorkspace?: boolean;
readonly group?: string;
Expand Down Expand Up @@ -137,6 +137,7 @@ interface IWorkspacePickerTriggerElements {
icon?: HTMLElement;
label?: HTMLElement;
badge?: CountBadge;
chevron?: HTMLElement;
}

type IWorkspacePickerAction = IAction & { ariaLabel?: string; icon?: ThemeIcon; hoverContent?: string; onRemove?: () => void };
Expand Down Expand Up @@ -1465,7 +1466,7 @@ export class WorkspacePicker extends Disposable {
trigger.classList.toggle('selected', (reflectsWorkspace && workspace !== undefined) || isSelectedCategory || badgeCount > 0 || relatedGitHubInfo !== undefined);
const icon = (reflectsWorkspace ? workspace?.icon : undefined)
?? (relatedGitHubInfo ? Codicon.repo : (isSelectedCategory && workspace ? workspace.icon : options.icon));
if (options.hideIconWhenAttached === true && badgeCount > 0) {
if (!icon || (options.hideIconWhenAttached === true && badgeCount > 0)) {
contents.icon?.remove();
contents.icon = undefined;
} else {
Expand Down Expand Up @@ -1496,6 +1497,12 @@ export class WorkspacePicker extends Disposable {
contents.badge?.dispose();
contents.badge = undefined;
}
if (!contents.chevron) {
contents.chevron = renderIcon(Codicon.chevronDownCompact);
contents.chevron.classList.add('sessions-chat-dropdown-chevron');
contents.chevron.setAttribute('aria-hidden', 'true');
}
trigger.append(contents.chevron);
return;
}

Expand Down
10 changes: 5 additions & 5 deletions src/vs/sessions/contrib/chat/test/browser/newChatWidget.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ interface ISendHarness {
interface IRenderWorkspacePickerHarness {
readonly _workspacePickerVisibleKey: { set(value: boolean): void };
readonly _workspacePicker: {
renderCategoryTriggers(container: HTMLElement, triggers: readonly { readonly label?: string; readonly tooltip?: string; readonly attachesContext?: boolean }[]): HTMLElement;
renderCategoryTriggers(container: HTMLElement, triggers: readonly { readonly label?: string; readonly tooltip?: string; readonly icon?: { readonly id: string }; readonly attachesContext?: boolean }[]): HTMLElement;
};
readonly _newChatInput: {
readonly sessionTypePicker: {
Expand Down Expand Up @@ -161,7 +161,7 @@ suite('NewChatWidget', () => {
test('workspace row hosts a multiple-harness picker first', () => {
const container = document.createElement('div');
const harnessLabels = ['Copilot', 'Claude'];
const workspaceTriggers: { readonly tooltip: string | undefined; readonly attachesContext: boolean | undefined }[] = [];
const workspaceTriggers: { readonly tooltip: string | undefined; readonly icon: string | undefined; readonly attachesContext: boolean | undefined }[] = [];
const harness: IRenderWorkspacePickerHarness = {
_workspacePickerVisibleKey: { set: () => { } },
_workspacePicker: {
Expand All @@ -172,7 +172,7 @@ suite('NewChatWidget', () => {
const item = document.createElement('div');
item.textContent = trigger.label ?? 'More';
row.appendChild(item);
workspaceTriggers.push({ tooltip: trigger.tooltip, attachesContext: trigger.attachesContext });
workspaceTriggers.push({ tooltip: trigger.tooltip, icon: trigger.icon?.id, attachesContext: trigger.attachesContext });
}
return row;
},
Expand Down Expand Up @@ -207,8 +207,8 @@ suite('NewChatWidget', () => {
],
);
assert.deepStrictEqual(workspaceTriggers, [
{ tooltip: 'Choose where the new session runs', attachesContext: false },
{ tooltip: 'Attach an issue or pull request as context', attachesContext: true },
{ tooltip: 'Choose where the new session runs', icon: 'project', attachesContext: false },
{ tooltip: 'Attach an issue or pull request as context', icon: undefined, attachesContext: true },
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1283,14 +1283,15 @@ suite('WorkspacePicker - Category Triggers', () => {
expanded: trigger.getAttribute('aria-expanded'),
role: trigger.getAttribute('role'),
tabIndex: trigger.tabIndex,
icons: Array.from(trigger.querySelectorAll<HTMLElement>('.codicon'), icon => icon.classList.item(1)),
})),
}, {
selectedFolderUri: folderUri.toString(),
triggers: [
{ label: 'local/project', ariaLabel: 'Folder: local/project', hidden: false, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0 },
{ label: 'Repo, Issue, or PR', ariaLabel: 'Choose a GitHub target', hidden: false, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0 },
{ label: 'Remote Setup', ariaLabel: 'Choose a remote setup', hidden: true, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0 },
{ label: undefined, ariaLabel: 'More workspace options', hidden: false, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0 },
{ label: 'local/project', ariaLabel: 'Folder: local/project', hidden: false, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0, icons: ['codicon-folder', 'codicon-chevron-down-compact'] },
{ label: 'Repo, Issue, or PR', ariaLabel: 'Choose a GitHub target', hidden: false, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0, icons: ['codicon-github', 'codicon-chevron-down-compact'] },
{ label: 'Remote Setup', ariaLabel: 'Choose a remote setup', hidden: true, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0, icons: ['codicon-radio-tower', 'codicon-chevron-down-compact'] },
{ label: undefined, ariaLabel: 'More workspace options', hidden: false, hasPopup: 'listbox', expanded: 'false', role: 'button', tabIndex: 0, icons: ['codicon-ellipsis', 'codicon-chevron-down-compact'] },
],
});
});
Expand Down Expand Up @@ -2175,7 +2176,7 @@ suite('WorkspacePicker - Category Triggers', () => {
const contextTrigger = container.querySelector<HTMLElement>('.action-label');
const getContextTriggerSnapshot = () => ({
label: contextTrigger?.querySelector('.sessions-chat-dropdown-label')?.textContent,
icon: contextTrigger?.querySelector('.codicon')?.className,
icon: contextTrigger?.querySelector('.codicon:not(.sessions-chat-dropdown-chevron)')?.className,
badge: contextTrigger?.querySelector('.monaco-count-badge')?.textContent,
ariaLabel: contextTrigger?.getAttribute('aria-label'),
});
Expand Down Expand Up @@ -2230,7 +2231,7 @@ suite('WorkspacePicker - Category Triggers', () => {
}]);
const contextTrigger = container.querySelector<HTMLElement>('.action-label');
const getContextTriggerSnapshot = () => ({
icon: contextTrigger?.querySelector('.codicon')?.className,
icon: contextTrigger?.querySelector('.codicon:not(.sessions-chat-dropdown-chevron)')?.className,
badge: contextTrigger?.querySelector('.monaco-count-badge')?.textContent,
ariaLabel: contextTrigger?.getAttribute('aria-label'),
});
Expand Down
Loading