mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 09:35:38 -05:00
Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)
* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f * fix various icon issues * fix preview features
This commit is contained in:
@@ -1,236 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { isMacintosh, isLinux, language } from 'vs/base/common/platform';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export class KeybindingsReferenceAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.keybindingsReference';
|
||||
static readonly LABEL = nls.localize('keybindingsReference', "Keyboard Shortcuts Reference");
|
||||
|
||||
private static readonly URL = isLinux ? product.keyboardShortcutsUrlLinux : isMacintosh ? product.keyboardShortcutsUrlMac : product.keyboardShortcutsUrlWin;
|
||||
static readonly AVAILABLE = !!KeybindingsReferenceAction.URL;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (KeybindingsReferenceAction.URL) {
|
||||
this.openerService.open(URI.parse(KeybindingsReferenceAction.URL));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenDocumentationUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openDocumentationUrl';
|
||||
static readonly LABEL = nls.localize('openDocumentationUrl', "Documentation");
|
||||
|
||||
private static readonly URL = product.documentationUrl;
|
||||
static readonly AVAILABLE = !!OpenDocumentationUrlAction.URL;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (OpenDocumentationUrlAction.URL) {
|
||||
this.openerService.open(URI.parse(OpenDocumentationUrlAction.URL));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenIntroductoryVideosUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openIntroductoryVideosUrl';
|
||||
static readonly LABEL = nls.localize('openIntroductoryVideosUrl', "Introductory Videos");
|
||||
|
||||
private static readonly URL = product.introductoryVideosUrl;
|
||||
static readonly AVAILABLE = !!OpenIntroductoryVideosUrlAction.URL;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (OpenIntroductoryVideosUrlAction.URL) {
|
||||
this.openerService.open(URI.parse(OpenIntroductoryVideosUrlAction.URL));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenTipsAndTricksUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openTipsAndTricksUrl';
|
||||
static readonly LABEL = nls.localize('openTipsAndTricksUrl', "Tips and Tricks");
|
||||
|
||||
private static readonly URL = product.tipsAndTricksUrl;
|
||||
static readonly AVAILABLE = !!OpenTipsAndTricksUrlAction.URL;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (OpenTipsAndTricksUrlAction.URL) {
|
||||
this.openerService.open(URI.parse(OpenTipsAndTricksUrlAction.URL));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenNewsletterSignupUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openNewsletterSignupUrl';
|
||||
static readonly LABEL = nls.localize('newsletterSignup', "Signup for the VS Code Newsletter");
|
||||
static readonly AVAILABLE = !!product.newsletterSignupUrl;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
const info = await this.telemetryService.getTelemetryInfo();
|
||||
|
||||
this.openerService.open(URI.parse(`${product.newsletterSignupUrl}?machineId=${encodeURIComponent(info.machineId)}`));
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenTwitterUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openTwitterUrl';
|
||||
static readonly LABEL = nls.localize('openTwitterUrl', "Join Us on Twitter", product.applicationName);
|
||||
static readonly AVAILABLE = !!product.twitterUrl;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (product.twitterUrl) {
|
||||
this.openerService.open(URI.parse(product.twitterUrl));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenRequestFeatureUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openRequestFeatureUrl';
|
||||
static readonly LABEL = nls.localize('openUserVoiceUrl', "Search Feature Requests");
|
||||
static readonly AVAILABLE = !!product.requestFeatureUrl;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (product.requestFeatureUrl) {
|
||||
this.openerService.open(URI.parse(product.requestFeatureUrl));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenLicenseUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openLicenseUrl';
|
||||
static readonly LABEL = nls.localize('openLicenseUrl', "View License");
|
||||
static readonly AVAILABLE = !!product.licenseUrl;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (product.licenseUrl) {
|
||||
if (language) {
|
||||
const queryArgChar = product.licenseUrl.indexOf('?') > 0 ? '&' : '?';
|
||||
this.openerService.open(URI.parse(`${product.licenseUrl}${queryArgChar}lang=${language}`));
|
||||
} else {
|
||||
this.openerService.open(URI.parse(product.licenseUrl));
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenPrivacyStatementUrlAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.openPrivacyStatementUrl';
|
||||
static readonly LABEL = nls.localize('openPrivacyStatement', "Privacy Statement");
|
||||
static readonly AVAILABE = !!product.privacyStatementUrl;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (product.privacyStatementUrl) {
|
||||
if (language) {
|
||||
const queryArgChar = product.privacyStatementUrl.indexOf('?') > 0 ? '&' : '?';
|
||||
this.openerService.open(URI.parse(`${product.privacyStatementUrl}${queryArgChar}lang=${language}`));
|
||||
} else {
|
||||
this.openerService.open(URI.parse(product.privacyStatementUrl));
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
|
||||
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
export class SaveWorkspaceAsAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.saveWorkspaceAs';
|
||||
static LABEL = nls.localize('saveWorkspaceAsAction', "Save Workspace As...");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
|
||||
@IWorkspaceEditingService private readonly workspaceEditingService: IWorkspaceEditingService
|
||||
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
async run(): Promise<any> {
|
||||
const configPathUri = await this.workspaceEditingService.pickNewWorkspacePath();
|
||||
if (configPathUri) {
|
||||
switch (this.contextService.getWorkbenchState()) {
|
||||
case WorkbenchState.EMPTY:
|
||||
case WorkbenchState.FOLDER:
|
||||
const folders = this.contextService.getWorkspace().folders.map(folder => ({ uri: folder.uri }));
|
||||
return this.workspaceEditingService.createAndEnterWorkspace(folders, configPathUri);
|
||||
case WorkbenchState.WORKSPACE:
|
||||
return this.workspaceEditingService.saveAndEnterWorkspace(configPathUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class DuplicateWorkspaceInNewWindowAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.duplicateWorkspaceInNewWindow';
|
||||
static readonly LABEL = nls.localize('duplicateWorkspaceInNewWindow', "Duplicate Workspace in New Window");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
|
||||
@IWorkspaceEditingService private readonly workspaceEditingService: IWorkspaceEditingService,
|
||||
@IWindowService private readonly windowService: IWindowService,
|
||||
@IWorkspacesService private readonly workspacesService: IWorkspacesService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
async run(): Promise<any> {
|
||||
const folders = this.workspaceContextService.getWorkspace().folders;
|
||||
const remoteAuthority = this.environmentService.configuration.remoteAuthority;
|
||||
|
||||
const newWorkspace = await this.workspacesService.createUntitledWorkspace(folders, remoteAuthority);
|
||||
await this.workspaceEditingService.copyWorkspaceSettings(newWorkspace);
|
||||
|
||||
return this.windowService.openWindow([{ workspaceUri: newWorkspace.configPath }], { forceNewWindow: true });
|
||||
}
|
||||
}
|
||||
|
||||
export class CloseWorkspaceAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.closeFolder';
|
||||
static LABEL = nls.localize('closeWorkspace', "Close Workspace");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IWindowService private readonly windowService: IWindowService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
|
||||
this.notificationService.info(nls.localize('noWorkspaceOpened', "There is currently no workspace opened in this instance to close."));
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return this.windowService.closeWorkspace();
|
||||
}
|
||||
}
|
||||
@@ -11,15 +11,13 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
|
||||
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
|
||||
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||
import { KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, OpenTipsAndTricksUrlAction, OpenTwitterUrlAction, OpenRequestFeatureUrlAction, OpenPrivacyStatementUrlAction, OpenLicenseUrlAction, OpenNewsletterSignupUrlAction } from 'vs/workbench/electron-browser/actions/helpActions';
|
||||
import { ToggleSharedProcessAction, ToggleDevToolsAction } from 'vs/workbench/electron-browser/actions/developerActions';
|
||||
import { ZoomResetAction, ZoomOutAction, ZoomInAction, CloseCurrentWindowAction, SwitchWindow, NewWindowAction, QuickSwitchWindow, ReloadWindowWithExtensionsDisabledAction, NewWindowTabHandler, ShowPreviousWindowTabHandler, ShowNextWindowTabHandler, MoveWindowTabToNewWindowHandler, MergeWindowTabsHandlerHandler, ToggleWindowTabsBarHandler } from 'vs/workbench/electron-browser/actions/windowActions';
|
||||
import { AddRootFolderAction, GlobalRemoveRootFolderAction, SaveWorkspaceAsAction, DuplicateWorkspaceInNewWindowAction, CloseWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions';
|
||||
import { SaveWorkspaceAsAction, DuplicateWorkspaceInNewWindowAction, CloseWorkspaceAction } from 'vs/workbench/electron-browser/actions/workspaceActions';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ADD_ROOT_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
|
||||
import { SupportsWorkspacesContext, IsMacContext, HasMacNativeTabsContext, IsDevelopmentContext, WorkbenchStateContext, WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys';
|
||||
import { NoEditorsVisibleContext, SingleEditorGroupsContext } from 'vs/workbench/common/editor';
|
||||
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
@@ -34,7 +32,7 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
|
||||
(function registerFileActions(): void {
|
||||
const fileCategory = nls.localize('file', "File");
|
||||
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseWorkspaceAction, CloseWorkspaceAction.ID, CloseWorkspaceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_F) }), 'File: Close Workspace', fileCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseWorkspaceAction, CloseWorkspaceAction.ID, CloseWorkspaceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_F) }), 'File: Close Workspace', fileCategory, SupportsWorkspacesContext);
|
||||
})();
|
||||
|
||||
// Actions: View
|
||||
@@ -81,10 +79,8 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
|
||||
(function registerWorkspaceActions(): void {
|
||||
const workspacesCategory = nls.localize('workspaces', "Workspaces");
|
||||
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(AddRootFolderAction, AddRootFolderAction.ID, AddRootFolderAction.LABEL), 'Workspaces: Add Folder to Workspace...', workspacesCategory, SupportsWorkspacesContext);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(GlobalRemoveRootFolderAction, GlobalRemoveRootFolderAction.ID, GlobalRemoveRootFolderAction.LABEL), 'Workspaces: Remove Folder from Workspace...', workspacesCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(SaveWorkspaceAsAction, SaveWorkspaceAsAction.ID, SaveWorkspaceAsAction.LABEL), 'Workspaces: Save Workspace As...', workspacesCategory, SupportsWorkspacesContext);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(DuplicateWorkspaceInNewWindowAction, DuplicateWorkspaceInNewWindowAction.ID, DuplicateWorkspaceInNewWindowAction.LABEL), 'Workspaces: Duplicate Workspace in New Window', workspacesCategory);
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(DuplicateWorkspaceInNewWindowAction, DuplicateWorkspaceInNewWindowAction.ID, DuplicateWorkspaceInNewWindowAction.LABEL), 'Workspaces: Duplicate Workspace in New Window', workspacesCategory, SupportsWorkspacesContext);
|
||||
})();
|
||||
|
||||
// Actions: macOS Native Tabs
|
||||
@@ -123,47 +119,6 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
|
||||
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_I }
|
||||
});
|
||||
})();
|
||||
|
||||
// Actions: help
|
||||
(function registerHelpActions(): void {
|
||||
const helpCategory = nls.localize('help', "Help");
|
||||
|
||||
if (KeybindingsReferenceAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(KeybindingsReferenceAction, KeybindingsReferenceAction.ID, KeybindingsReferenceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_R) }), 'Help: Keyboard Shortcuts Reference', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenDocumentationUrlAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDocumentationUrlAction, OpenDocumentationUrlAction.ID, OpenDocumentationUrlAction.LABEL), 'Help: Documentation', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenIntroductoryVideosUrlAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenIntroductoryVideosUrlAction, OpenIntroductoryVideosUrlAction.ID, OpenIntroductoryVideosUrlAction.LABEL), 'Help: Introductory Videos', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenTipsAndTricksUrlAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenTipsAndTricksUrlAction, OpenTipsAndTricksUrlAction.ID, OpenTipsAndTricksUrlAction.LABEL), 'Help: Tips and Tricks', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenNewsletterSignupUrlAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNewsletterSignupUrlAction, OpenNewsletterSignupUrlAction.ID, OpenNewsletterSignupUrlAction.LABEL), 'Help: Tips and Tricks', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenTwitterUrlAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenTwitterUrlAction, OpenTwitterUrlAction.ID, OpenTwitterUrlAction.LABEL), 'Help: Join Us on Twitter', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenRequestFeatureUrlAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRequestFeatureUrlAction, OpenRequestFeatureUrlAction.ID, OpenRequestFeatureUrlAction.LABEL), 'Help: Search Feature Requests', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenLicenseUrlAction.AVAILABLE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenLicenseUrlAction, OpenLicenseUrlAction.ID, OpenLicenseUrlAction.LABEL), 'Help: View License', helpCategory);
|
||||
}
|
||||
|
||||
if (OpenPrivacyStatementUrlAction.AVAILABE) {
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPrivacyStatementUrlAction, OpenPrivacyStatementUrlAction.ID, OpenPrivacyStatementUrlAction.LABEL), 'Help: Privacy Statement', helpCategory);
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
||||
// Menu
|
||||
@@ -186,16 +141,6 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
|
||||
}
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
|
||||
group: '3_workspace',
|
||||
command: {
|
||||
id: ADD_ROOT_FOLDER_COMMAND_ID,
|
||||
title: nls.localize({ key: 'miAddFolderToWorkspace', comment: ['&& denotes a mnemonic'] }, "A&&dd Folder to Workspace...")
|
||||
},
|
||||
order: 1,
|
||||
when: SupportsWorkspacesContext
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
|
||||
group: '3_workspace',
|
||||
command: {
|
||||
@@ -224,7 +169,7 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
|
||||
title: nls.localize({ key: 'miCloseWorkspace', comment: ['&& denotes a mnemonic'] }, "Close &&Workspace")
|
||||
},
|
||||
order: 3,
|
||||
when: WorkbenchStateContext.isEqualTo('workspace')
|
||||
when: ContextKeyExpr.and(WorkbenchStateContext.isEqualTo('workspace'), SupportsWorkspacesContext)
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
|
||||
@@ -275,87 +220,6 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
|
||||
order: 3
|
||||
});
|
||||
|
||||
// Help
|
||||
|
||||
if (OpenDocumentationUrlAction.AVAILABLE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '1_welcome',
|
||||
command: {
|
||||
id: OpenDocumentationUrlAction.ID,
|
||||
title: nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")
|
||||
},
|
||||
order: 3
|
||||
});
|
||||
}
|
||||
|
||||
/* // {{SQL CARBON EDIT}} - Disable unused menu item
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '1_welcome',
|
||||
command: {
|
||||
id: 'update.showCurrentReleaseNotes',
|
||||
title: nls.localize({ key: 'miReleaseNotes', comment: ['&& denotes a mnemonic'] }, "&&Release Notes")
|
||||
},
|
||||
order: 4
|
||||
});
|
||||
|
||||
// Reference
|
||||
if (KeybindingsReferenceAction.AVAILABLE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '2_reference',
|
||||
command: {
|
||||
id: KeybindingsReferenceAction.ID,
|
||||
title: nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")
|
||||
},
|
||||
order: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (OpenIntroductoryVideosUrlAction.AVAILABLE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '2_reference',
|
||||
command: {
|
||||
id: OpenIntroductoryVideosUrlAction.ID,
|
||||
title: nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
}
|
||||
|
||||
if (OpenTipsAndTricksUrlAction.AVAILABLE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '2_reference',
|
||||
command: {
|
||||
id: OpenTipsAndTricksUrlAction.ID,
|
||||
title: nls.localize({ key: 'miTipsAndTricks', comment: ['&& denotes a mnemonic'] }, "Tips and Tri&&cks")
|
||||
},
|
||||
order: 3
|
||||
});
|
||||
}
|
||||
|
||||
// Feedback
|
||||
if (OpenTwitterUrlAction.AVAILABLE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '3_feedback',
|
||||
command: {
|
||||
id: OpenTwitterUrlAction.ID,
|
||||
title: nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join Us on Twitter")
|
||||
},
|
||||
order: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (OpenRequestFeatureUrlAction.AVAILABLE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '3_feedback',
|
||||
command: {
|
||||
id: OpenRequestFeatureUrlAction.ID,
|
||||
title: nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '3_feedback',
|
||||
command: {
|
||||
@@ -365,29 +229,6 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
|
||||
order: 3
|
||||
});
|
||||
|
||||
// Legal
|
||||
if (OpenLicenseUrlAction.AVAILABLE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '4_legal',
|
||||
command: {
|
||||
id: OpenLicenseUrlAction.ID,
|
||||
title: nls.localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "View &&License")
|
||||
},
|
||||
order: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (OpenPrivacyStatementUrlAction.AVAILABE) {
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '4_legal',
|
||||
command: {
|
||||
id: OpenPrivacyStatementUrlAction.ID,
|
||||
title: nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "Privac&&y Statement")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
}
|
||||
|
||||
// Tools
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '5_tools',
|
||||
|
||||
@@ -23,9 +23,9 @@ import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron
|
||||
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
|
||||
import { webFrame } from 'electron';
|
||||
import { ISingleFolderWorkspaceIdentifier, IWorkspaceInitializationPayload, ISingleFolderWorkspaceInitializationPayload, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ConsoleLogService, MultiplexLogService, ILogService } from 'vs/platform/log/common/log';
|
||||
import { ConsoleLogService, MultiplexLogService, ILogService, ConsoleLogInMainService } from 'vs/platform/log/common/log';
|
||||
import { StorageService } from 'vs/platform/storage/node/storageService';
|
||||
import { LogLevelSetterChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
|
||||
import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { sanitizeFilePath } from 'vs/base/common/extpath';
|
||||
import { GlobalStorageDatabaseChannelClient } from 'vs/platform/storage/node/storageIpc';
|
||||
@@ -51,8 +51,8 @@ import { SignService } from 'vs/platform/sign/node/signService';
|
||||
import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
|
||||
class CodeRendererMain extends Disposable {
|
||||
|
||||
@@ -345,12 +345,25 @@ class CodeRendererMain extends Disposable {
|
||||
}
|
||||
|
||||
private createLogService(mainProcessService: IMainProcessService, environmentService: IWorkbenchEnvironmentService): ILogService {
|
||||
const spdlogService = new SpdLogService(`renderer${this.environmentService.configuration.windowId}`, environmentService.logsPath, this.environmentService.configuration.logLevel);
|
||||
const consoleLogService = new ConsoleLogService(this.environmentService.configuration.logLevel);
|
||||
const logService = new MultiplexLogService([consoleLogService, spdlogService]);
|
||||
const logLevelClient = new LogLevelSetterChannelClient(mainProcessService.getChannel('loglevel'));
|
||||
const loggerClient = new LoggerChannelClient(mainProcessService.getChannel('logger'));
|
||||
|
||||
return new FollowerLogService(logLevelClient, logService);
|
||||
// Extension development test CLI: forward everything to main side
|
||||
const loggers: ILogService[] = [];
|
||||
if (environmentService.isExtensionDevelopment && !!environmentService.extensionTestsLocationURI) {
|
||||
loggers.push(
|
||||
new ConsoleLogInMainService(loggerClient, this.environmentService.configuration.logLevel)
|
||||
);
|
||||
}
|
||||
|
||||
// Normal logger: spdylog and console
|
||||
else {
|
||||
loggers.push(
|
||||
new ConsoleLogService(this.environmentService.configuration.logLevel),
|
||||
new SpdLogService(`renderer${this.environmentService.configuration.windowId}`, environmentService.logsPath, this.environmentService.configuration.logLevel)
|
||||
);
|
||||
}
|
||||
|
||||
return new FollowerLogService(loggerClient, new MultiplexLogService(loggers));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
||||
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
|
||||
import { IWorkbenchThemeService, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IResourceInput } from 'vs/platform/editor/common/editor';
|
||||
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
|
||||
import { ipcRenderer as ipc, webFrame, crashReporter, Event } from 'electron';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
|
||||
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, SubmenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, SubmenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
@@ -32,9 +32,8 @@ import { IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecyc
|
||||
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
|
||||
import { isRootUser, isWindows, isMacintosh, isLinux, isWeb } from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import { isRootUser, isWindows, isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
@@ -56,6 +55,9 @@ import { IMenubarService, IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenub
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
import { posix, dirname } from 'vs/base/common/path';
|
||||
import { getBaseLabel } from 'vs/base/common/labels';
|
||||
|
||||
const TextInputActions: IAction[] = [
|
||||
new Action('undo', nls.localize('undo', "Undo"), undefined, true, () => Promise.resolve(document.execCommand('undo'))),
|
||||
@@ -74,6 +76,8 @@ export class ElectronWindow extends Disposable {
|
||||
private readonly touchBarDisposables = this._register(new DisposableStore());
|
||||
private lastInstalledTouchedBar: ICommandAction[][] | undefined;
|
||||
|
||||
private customTitleContextMenuDisposable = this._register(new DisposableStore());
|
||||
|
||||
private previousConfiguredZoomLevel: number | undefined;
|
||||
|
||||
private addFoldersScheduler: RunOnceScheduler;
|
||||
@@ -103,7 +107,8 @@ export class ElectronWindow extends Disposable {
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
|
||||
@ITextFileService private readonly textFileService: ITextFileService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IElectronService private readonly electronService: IElectronService
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -244,6 +249,11 @@ export class ElectronWindow extends Disposable {
|
||||
|
||||
this._register(this.trackClosedWaitFiles(waitMarkerFile, resourcesToWaitFor));
|
||||
}
|
||||
|
||||
// macOS custom title menu
|
||||
if (isMacintosh) {
|
||||
this._register(this.editorService.onDidActiveEditorChange(() => this.provideCustomTitleContextMenu()));
|
||||
}
|
||||
}
|
||||
|
||||
private onDidVisibleEditorsChange(): void {
|
||||
@@ -307,6 +317,43 @@ export class ElectronWindow extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private provideCustomTitleContextMenu(): void {
|
||||
|
||||
// Clear old menu
|
||||
this.customTitleContextMenuDisposable.clear();
|
||||
|
||||
// Provide new menu if a file is opened and we are on a custom title
|
||||
const fileResource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER, filterByScheme: Schemas.file });
|
||||
if (!fileResource || getTitleBarStyle(this.configurationService, this.environmentService) !== 'custom') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Split up filepath into segments
|
||||
const filePath = fileResource.fsPath;
|
||||
const segments = filePath.split(posix.sep);
|
||||
for (let i = segments.length; i > 0; i--) {
|
||||
const isFile = (i === segments.length);
|
||||
|
||||
let pathOffset = i;
|
||||
if (!isFile) {
|
||||
pathOffset++; // for segments which are not the file name we want to open the folder
|
||||
}
|
||||
|
||||
const path = segments.slice(0, pathOffset).join(posix.sep);
|
||||
|
||||
let label: string;
|
||||
if (!isFile) {
|
||||
label = getBaseLabel(dirname(path));
|
||||
} else {
|
||||
label = getBaseLabel(path);
|
||||
}
|
||||
|
||||
const commandId = `workbench.action.revealPathInFinder${i}`;
|
||||
this.customTitleContextMenuDisposable.add(CommandsRegistry.registerCommand(commandId, () => this.electronService.showItemInFolder(path)));
|
||||
this.customTitleContextMenuDisposable.add(MenuRegistry.appendMenuItem(MenuId.TitleBarContext, { command: { id: commandId, title: label || posix.sep }, order: -i }));
|
||||
}
|
||||
}
|
||||
|
||||
private create(): void {
|
||||
|
||||
// Native menu controller
|
||||
@@ -372,7 +419,7 @@ export class ElectronWindow extends Disposable {
|
||||
const success = await $this.windowsService.openExternal(encodeURI(resource.toString(true)));
|
||||
if (!success && resource.scheme === Schemas.file) {
|
||||
// if opening failed, and this is a file, we can still try to reveal it
|
||||
await $this.windowsService.showItemInFolder(resource);
|
||||
await $this.electronService.showItemInFolder(resource.fsPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -460,7 +507,7 @@ export class ElectronWindow extends Disposable {
|
||||
productName,
|
||||
submitURL: isWindows ? hockeyAppConfig[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? hockeyAppConfig[`linux-x64`] : hockeyAppConfig.darwin,
|
||||
extra: {
|
||||
vscode_version: pkg.version,
|
||||
vscode_version: product.version,
|
||||
vscode_commit: product.commit
|
||||
}
|
||||
};
|
||||
@@ -615,7 +662,7 @@ class NativeMenubarControl extends MenubarControl {
|
||||
environmentService,
|
||||
accessibilityService);
|
||||
|
||||
if (isMacintosh && !isWeb) {
|
||||
if (isMacintosh) {
|
||||
this.menus['Preferences'] = this._register(this.menuService.createMenu(MenuId.MenubarPreferencesMenu, this.contextKeyService));
|
||||
this.topLevelTitles['Preferences'] = nls.localize('mPreferences', "Preferences");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user