Skip to content

Commit

Permalink
Some command labels in the keybindings editor are showing & (fix #228911
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Sep 18, 2024
1 parent 3ea0cbb commit dec258d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/vs/base/common/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ export function unmnemonicLabel(label: string): string {
return label.replace(/&/g, '&&');
}

export function stripMnemonicLabel(label: string): string {
return label.replace(/&&/g, '');
}

/**
* Splits a recent label in name and parent path, supporting both '/' and '\' and workspace suffixes.
* If the location is remote, the remote name is included in the name part.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { IEditorGroup } from '../../../services/editor/common/editorGroupsServic
import type { IManagedHover } from '../../../../base/browser/ui/hover/hover.js';
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
import { IAccessibilityService } from '../../../../platform/accessibility/common/accessibility.js';
import { stripMnemonicLabel } from '../../../../base/common/labels.js';

const $ = DOM.$;

Expand Down Expand Up @@ -567,7 +568,7 @@ export class KeybindingsEditor extends EditorPane implements IKeybindingsEditorP
if (isIMenuItem(menuItem)) {
const title = typeof menuItem.command.title === 'string' ? menuItem.command.title : menuItem.command.title.value;
const category = menuItem.command.category ? typeof menuItem.command.category === 'string' ? menuItem.command.category : menuItem.command.category.value : undefined;
actionsLabels.set(menuItem.command.id, category ? `${category}: ${title}` : title);
actionsLabels.set(menuItem.command.id, stripMnemonicLabel(category ? `${category}: ${title}` : title));
}
}
return actionsLabels;
Expand Down

0 comments on commit dec258d

Please sign in to comment.