macOS - offer the action to open a folder and rename "Open Workspace" (fix #131793)

This commit is contained in:
Benjamin Pasero
2021-09-01 18:31:47 +02:00
parent 919d4dd22c
commit 218fc0900a
5 changed files with 15 additions and 9 deletions
@@ -72,7 +72,7 @@ export class DialogMainService implements IDialogMainService {
}
pickWorkspace(options: INativeOpenDialogOptions, window?: BrowserWindow): Promise<string[] | undefined> {
const title = localize('openWorkspaceTitle', "Open Workspace");
const title = localize('openWorkspaceTitle', "Open Workspace from File");
const buttonLabel = mnemonicButtonLabel(localize({ key: 'openWorkspace', comment: ['&& denotes a mnemonic'] }, "&&Open"));
const filters = WORKSPACE_FILTER;
@@ -60,10 +60,16 @@ export class OpenFolderAction extends Action2 {
title: { value: localize('openFolder', "Open Folder..."), original: 'Open Folder...' },
category: fileCategory,
f1: true,
precondition: ContextKeyExpr.and(IsMacNativeContext.toNegated(), OpenFolderWorkspaceSupportContext),
precondition: OpenFolderWorkspaceSupportContext,
keybinding: {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_O)
primary: undefined,
linux: {
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_O)
},
win: {
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_O)
}
}
});
}
@@ -108,7 +114,7 @@ class OpenWorkspaceAction extends Action2 {
constructor() {
super({
id: OpenWorkspaceAction.ID,
title: { value: localize('openWorkspaceAction', "Open Workspace..."), original: 'Open Workspace...' },
title: { value: localize('openWorkspaceAction', "Open Workspace from File..."), original: 'Open Workspace from File...' },
category: fileCategory,
f1: true,
precondition: EnterMultiRootWorkspaceSupportContext
@@ -314,7 +320,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
title: localize({ key: 'miOpenFolder', comment: ['&& denotes a mnemonic'] }, "Open &&Folder...")
},
order: 2,
when: ContextKeyExpr.and(IsMacNativeContext.toNegated(), OpenFolderWorkspaceSupportContext)
when: OpenFolderWorkspaceSupportContext
});
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
@@ -331,7 +337,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '2_open',
command: {
id: OpenWorkspaceAction.ID,
title: localize({ key: 'miOpenWorkspace', comment: ['&& denotes a mnemonic'] }, "Open Wor&&kspace...")
title: localize({ key: 'miOpenWorkspace', comment: ['&& denotes a mnemonic'] }, "Open Wor&&kspace from File...")
},
order: 3,
when: EnterMultiRootWorkspaceSupportContext
+1 -1
View File
@@ -160,7 +160,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
this.emptyWorkspaceSupportContext.set(isNative || typeof this.environmentService.remoteAuthority === 'string');
// Entering a multi root workspace support: support for entering a multi-root
// workspace (e.g. "Open Workspace...", "Duplicate Workspace", "Save Workspace")
// workspace (e.g. "Open Workspace from File...", "Duplicate Workspace", "Save Workspace")
// is driven by the ability to resolve a workspace configuration file (*.code-workspace)
// with a built-in file system provider.
// This condition is met:
@@ -102,7 +102,7 @@ export const startEntries: GettingStartedStartEntryContent = [
title: localize('gettingStarted.openFolder.title', "Open Folder..."),
description: localize('gettingStarted.openFolder.description', "Open a folder to start working"),
icon: Codicon.folderOpened,
when: '!isWeb && !isMac',
when: '!isWeb',
content: {
type: 'startEntry',
command: 'workbench.action.files.openFolder',
@@ -208,7 +208,7 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
}
protected async pickWorkspaceAndOpenSimplified(schema: string, options: IPickAndOpenOptions): Promise<void> {
const title = nls.localize('openWorkspace.title', 'Open Workspace');
const title = nls.localize('openWorkspace.title', 'Open Workspace from File');
const filters: FileFilter[] = [{ name: nls.localize('filterName.workspace', 'Workspace'), extensions: [WORKSPACE_EXTENSION] }];
const availableFileSystems = this.addFileSchemaIfNeeded(schema, true);