macOS File Options disables

Why are file options disabled for macOS? A number of workspace commands have the following: !isOSX && this.isElectron()

Furthermore, is there any way to avoid this (Have also tried menus with no OS checks, FILE_OPEN for example)? We are using the following code to enable a workspace command:

@injectable()
export class ProjectCreatorMenuContribution implements MenuContribution {

    registerMenus(menus: MenuModelRegistry): void {
        menus.registerMenuAction(CommonMenus.FILE_NEW, {
            commandId: ProjectCreateCommand.id,
            label: 'New Project'
        });
    }
}

Thanks for your help!

@kaustav-aarish thanks for the discussion, certain commands were added only in the electron (desktop) applications, while some are only available for certain operating systems in order to align with similar menus found in vscode.

Furthermore, is there any way to avoid this (Have also tried menus with no OS checks, FILE_OPEN for example)? We are using the following code to enable a workspace command:

If you would not like to rebind the whole contribution, you can register a custom command which is enabled/visible based on your requirements and it’s execute callback can simply execute the original command.

For instance:

 registerCommands(commands: CommandRegistry): void {
        // Updated command.
        commands.registerCommand(WorkspaceCommands.OPEN_CUSTOM, {
            isEnabled: () => true,
            isVisible: () => true,
            execute: () => commands.executeCommand(WorkspaceCommands.OPEN)
        });

You can then use your custom commands for menus.

Because you cannot have a native file dialog with both file and folder selectors on Linux and Windows. See here. So we had to make some restrictions.

1 Like