提交 5e01fd0c 编写于 作者: B Benjamin Pasero

fix #93935

上级 0f5371ae
......@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
import { IQuickPickSeparator, quickPickItemScorerAccessor, IQuickPickItemWithResource, IQuickPick } from 'vs/platform/quickinput/common/quickInput';
import { PickerQuickAccessProvider, IPickerQuickAccessItem, TriggerAction } from 'vs/platform/quickinput/browser/pickerQuickAccess';
import { IEditorGroupsService, GroupsOrder } from 'vs/workbench/services/editor/common/editorGroupsService';
import { EditorsOrder, IEditorIdentifier, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
import { EditorsOrder, IEditorIdentifier, toResource, SideBySideEditor, GroupIdentifier } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
......@@ -113,6 +113,18 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
}
private doGetEditorPickItems(): Array<IEditorQuickPickItem> {
const editors = this.doGetEditors();
const mapGroupIdToGroupAriaLabel = new Map<GroupIdentifier, string>();
for (const { groupId } of editors) {
if (!mapGroupIdToGroupAriaLabel.has(groupId)) {
const group = this.editorGroupService.getGroup(groupId);
if (group) {
mapGroupIdToGroupAriaLabel.set(groupId, group.ariaLabel);
}
}
}
return this.doGetEditors().map(({ editor, groupId }): IEditorQuickPickItem => {
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const isDirty = editor.isDirty() && !editor.isSaving();
......@@ -122,7 +134,13 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
groupId,
resource,
label: editor.getName(),
ariaLabel: localize('entryAriaLabel', "{0}, editors picker", editor.getName()),
ariaLabel: (() => {
if (mapGroupIdToGroupAriaLabel.size > 1) {
return localize('entryAriaLabelWithGroup', "{0}, {1}, editors picker", editor.getName(), mapGroupIdToGroupAriaLabel.get(groupId));
}
return localize('entryAriaLabel', "{0}, editors picker", editor.getName());
})(),
description: editor.getDescription(),
iconClasses: getIconClasses(this.modelService, this.modeService, resource),
italic: !this.editorGroupService.getGroup(groupId)?.isPinned(editor),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册