Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)

* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f

* fix various icon issues

* fix preview features
This commit is contained in:
Anthony Dresser
2019-09-19 21:50:52 -07:00
committed by GitHub
parent 9d3d64eef3
commit db498db0a8
459 changed files with 10195 additions and 7528 deletions

View File

@@ -27,7 +27,7 @@ import { clamp } from 'vs/base/common/numbers';
import { KeyCode } from 'vs/base/common/keyCodes';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
export class InspectContextKeysAction extends Action {
class InspectContextKeysAction extends Action {
static readonly ID = 'workbench.action.inspectContextKeys';
static LABEL = nls.localize('inspect context keys', "Inspect Context Keys");
@@ -91,7 +91,7 @@ export class InspectContextKeysAction extends Action {
}
}
export class ToggleScreencastModeAction extends Action {
class ToggleScreencastModeAction extends Action {
static readonly ID = 'workbench.action.toggleScreencastMode';
static LABEL = nls.localize('toggle screencast mode', "Toggle Screencast Mode");
@@ -195,7 +195,7 @@ export class ToggleScreencastModeAction extends Action {
}
}
export class LogStorageAction extends Action {
class LogStorageAction extends Action {
static readonly ID = 'workbench.action.logStorage';
static LABEL = nls.localize({ key: 'logStorage', comment: ['A developer only action to log the contents of the storage for the current window.'] }, "Log Storage Database Contents");
@@ -224,8 +224,6 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(InspectContextKeysActi
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleScreencastModeAction, ToggleScreencastModeAction.ID, ToggleScreencastModeAction.LABEL), 'Developer: Toggle Screencast Mode', developerCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(LogStorageAction, LogStorageAction.ID, LogStorageAction.LABEL), 'Developer: Log Storage Database Contents', developerCategory);
// --- Menu Registration
// Screencast Mode
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
configurationRegistry.registerConfiguration({

View File

@@ -0,0 +1,388 @@
/*---------------------------------------------------------------------------------------------
* 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/common/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';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { KeyChord, KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { IProductService } from 'vs/platform/product/common/productService';
class KeybindingsReferenceAction extends Action {
static readonly ID = 'workbench.action.keybindingsReference';
static readonly LABEL = nls.localize('keybindingsReference', "Keyboard Shortcuts Reference");
static readonly AVAILABLE = !!(isLinux ? product.keyboardShortcutsUrlLinux : isMacintosh ? product.keyboardShortcutsUrlMac : product.keyboardShortcutsUrlWin);
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
const url = isLinux ? this.productService.keyboardShortcutsUrlLinux : isMacintosh ? this.productService.keyboardShortcutsUrlMac : this.productService.keyboardShortcutsUrlWin;
if (url) {
this.openerService.open(URI.parse(url));
}
return Promise.resolve();
}
}
class OpenDocumentationUrlAction extends Action {
static readonly ID = 'workbench.action.openDocumentationUrl';
static readonly LABEL = nls.localize('openDocumentationUrl', "Documentation");
static readonly AVAILABLE = !!product.documentationUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
if (this.productService.documentationUrl) {
this.openerService.open(URI.parse(this.productService.documentationUrl));
}
return Promise.resolve();
}
}
class OpenIntroductoryVideosUrlAction extends Action {
static readonly ID = 'workbench.action.openIntroductoryVideosUrl';
static readonly LABEL = nls.localize('openIntroductoryVideosUrl', "Introductory Videos");
static readonly AVAILABLE = !!product.introductoryVideosUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
if (this.productService.introductoryVideosUrl) {
this.openerService.open(URI.parse(this.productService.introductoryVideosUrl));
}
return Promise.resolve();
}
}
class OpenTipsAndTricksUrlAction extends Action {
static readonly ID = 'workbench.action.openTipsAndTricksUrl';
static readonly LABEL = nls.localize('openTipsAndTricksUrl', "Tips and Tricks");
static readonly AVAILABLE = !!product.tipsAndTricksUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
if (this.productService.tipsAndTricksUrl) {
this.openerService.open(URI.parse(this.productService.tipsAndTricksUrl));
}
return Promise.resolve();
}
}
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,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
async run(): Promise<void> {
const info = await this.telemetryService.getTelemetryInfo();
this.openerService.open(URI.parse(`${this.productService.newsletterSignupUrl}?machineId=${encodeURIComponent(info.machineId)}`));
}
}
class OpenTwitterUrlAction extends Action {
static readonly ID = 'workbench.action.openTwitterUrl';
static readonly LABEL = nls.localize('openTwitterUrl', "Join Us on Twitter");
static readonly AVAILABLE = !!product.twitterUrl;
constructor(
id: string,
label: string,
@IOpenerService private readonly openerService: IOpenerService,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
if (this.productService.twitterUrl) {
this.openerService.open(URI.parse(this.productService.twitterUrl));
}
return Promise.resolve();
}
}
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,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
if (this.productService.requestFeatureUrl) {
this.openerService.open(URI.parse(this.productService.requestFeatureUrl));
}
return Promise.resolve();
}
}
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,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
if (this.productService.licenseUrl) {
if (language) {
const queryArgChar = this.productService.licenseUrl.indexOf('?') > 0 ? '&' : '?';
this.openerService.open(URI.parse(`${this.productService.licenseUrl}${queryArgChar}lang=${language}`));
} else {
this.openerService.open(URI.parse(this.productService.licenseUrl));
}
}
return Promise.resolve();
}
}
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,
@IProductService private readonly productService: IProductService
) {
super(id, label);
}
run(): Promise<void> {
if (this.productService.privacyStatementUrl) {
if (language) {
const queryArgChar = this.productService.privacyStatementUrl.indexOf('?') > 0 ? '&' : '?';
this.openerService.open(URI.parse(`${this.productService.privacyStatementUrl}${queryArgChar}lang=${language}`));
} else {
this.openerService.open(URI.parse(this.productService.privacyStatementUrl));
}
}
return Promise.resolve();
}
}
// --- Actions Registration
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
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 Registration
// 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
});
}*/
// 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
});
}

View File

@@ -12,7 +12,6 @@ import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IEditorGroupsService, GroupOrientation } from 'vs/workbench/services/editor/common/editorGroupsService';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes';
@@ -142,15 +141,6 @@ export class ToggleEditorLayoutAction extends Action {
}
}
CommandsRegistry.registerCommand('_workbench.editor.setGroupOrientation', function (accessor: ServicesAccessor, args: [GroupOrientation]) {
const editorGroupService = accessor.get(IEditorGroupsService);
const [orientation] = args;
editorGroupService.setGroupOrientation(orientation);
return Promise.resolve();
});
const group = viewCategory;
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleEditorLayoutAction, ToggleEditorLayoutAction.ID, ToggleEditorLayoutAction.LABEL, { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_0, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_0 } }), 'View: Toggle Vertical/Horizontal Editor Layout', group);

View File

@@ -7,7 +7,8 @@ import 'vs/css!./media/actions';
import * as nls from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IWindowService, IURIToOpen, IWindowsService } from 'vs/platform/windows/common/windows';
import { IWindowService, IURIToOpen } from 'vs/platform/windows/common/windows';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { Registry } from 'vs/platform/registry/common/platform';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
@@ -162,7 +163,7 @@ export class OpenRecentAction extends BaseOpenRecentAction {
}
}
export class QuickOpenRecentAction extends BaseOpenRecentAction {
class QuickOpenRecentAction extends BaseOpenRecentAction {
static readonly ID = 'workbench.action.quickOpenRecent';
static readonly LABEL = nls.localize('quickOpenRecent', "Quick Open Recent...");
@@ -186,7 +187,7 @@ export class QuickOpenRecentAction extends BaseOpenRecentAction {
}
}
export class ToggleFullScreenAction extends Action {
class ToggleFullScreenAction extends Action {
static readonly ID = 'workbench.action.toggleFullScreen';
static LABEL = nls.localize('toggleFullScreen', "Toggle Full Screen");
@@ -226,7 +227,7 @@ export class ReloadWindowAction extends Action {
}
}
export class ShowAboutDialogAction extends Action {
class ShowAboutDialogAction extends Action {
static readonly ID = 'workbench.action.showAboutDialog';
static readonly LABEL = nls.localize('about', "About");
@@ -234,13 +235,13 @@ export class ShowAboutDialogAction extends Action {
constructor(
id: string,
label: string,
@IWindowsService private readonly windowsService: IWindowsService
@IDialogService private readonly dialogService: IDialogService
) {
super(id, label);
}
run(): Promise<void> {
return this.windowsService.openAboutDialog();
return this.dialogService.about();
}
}

View File

@@ -5,24 +5,18 @@
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ICommandService, ICommandHandler, CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL, PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { Schemas } from 'vs/base/common/network';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ITextFileService, ISaveOptions } from 'vs/workbench/services/textfile/common/textfiles';
import { toResource } from 'vs/workbench/common/editor';
import { URI } from 'vs/base/common/uri';
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { WorkbenchStateContext } from 'vs/workbench/browser/contextkeys';
import { MenuRegistry, MenuId, SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { WorkbenchStateContext, SupportsWorkspacesContext } from 'vs/workbench/browser/contextkeys';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
export class OpenFileAction extends Action {
@@ -42,36 +36,6 @@ export class OpenFileAction extends Action {
}
}
export namespace OpenLocalFileCommand {
export const ID = 'workbench.action.files.openLocalFile';
export const LABEL = nls.localize('openLocalFile', "Open Local File...");
export function handler(): ICommandHandler {
return accessor => {
const dialogService = accessor.get(IFileDialogService);
return dialogService.pickFileAndOpen({ forceNewWindow: false, availableFileSystems: [Schemas.file] });
};
}
}
export namespace SaveLocalFileCommand {
export const ID = 'workbench.action.files.saveLocalFile';
export const LABEL = nls.localize('saveLocalFile', "Save Local File...");
export function handler(): ICommandHandler {
return accessor => {
const textFileService = accessor.get(ITextFileService);
const editorService = accessor.get(IEditorService);
let resource: URI | undefined = toResource(editorService.activeEditor);
const options: ISaveOptions = { force: true, availableFileSystems: [Schemas.file] };
if (resource) {
return textFileService.saveAs(resource, undefined, options);
}
return Promise.resolve(undefined);
};
}
}
export class OpenFolderAction extends Action {
static readonly ID = 'workbench.action.files.openFolder';
@@ -90,19 +54,6 @@ export class OpenFolderAction extends Action {
}
}
export namespace OpenLocalFolderCommand {
export const ID = 'workbench.action.files.openLocalFolder';
export const LABEL = nls.localize('openLocalFolder', "Open Local Folder...");
export function handler(): ICommandHandler {
return accessor => {
const dialogService = accessor.get(IFileDialogService);
return dialogService.pickFolderAndOpen({ forceNewWindow: false, availableFileSystems: [Schemas.file] });
};
}
}
export class OpenFileFolderAction extends Action {
static readonly ID = 'workbench.action.files.openFileFolder';
@@ -121,16 +72,46 @@ export class OpenFileFolderAction extends Action {
}
}
export namespace OpenLocalFileFolderCommand {
export class OpenWorkspaceAction extends Action {
export const ID = 'workbench.action.files.openLocalFileFolder';
export const LABEL = nls.localize('openLocalFileFolder', "Open Local...");
static readonly ID = 'workbench.action.openWorkspace';
static LABEL = nls.localize('openWorkspaceAction', "Open Workspace...");
export function handler(): ICommandHandler {
return accessor => {
const dialogService = accessor.get(IFileDialogService);
return dialogService.pickFileFolderAndOpen({ forceNewWindow: false, availableFileSystems: [Schemas.file] });
};
constructor(
id: string,
label: string,
@IFileDialogService private readonly dialogService: IFileDialogService
) {
super(id, label);
}
run(event?: any, data?: ITelemetryData): Promise<any> {
return this.dialogService.pickWorkspaceAndOpen({ telemetryExtraData: data });
}
}
export class OpenWorkspaceConfigFileAction extends Action {
static readonly ID = 'workbench.action.openWorkspaceConfigFile';
static readonly LABEL = nls.localize('openWorkspaceConfigFile', "Open Workspace Configuration File");
constructor(
id: string,
label: string,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IEditorService private readonly editorService: IEditorService
) {
super(id, label);
this.enabled = !!this.workspaceContextService.getWorkspace().configuration;
}
run(): Promise<any> {
const configuration = this.workspaceContextService.getWorkspace().configuration;
if (configuration) {
return this.editorService.openEditor({ resource: configuration });
}
return Promise.resolve();
}
}
@@ -182,141 +163,30 @@ export class GlobalRemoveRootFolderAction extends Action {
}
}
export class SaveWorkspaceAsAction extends Action {
// --- Actions Registration
static readonly ID = 'workbench.action.saveWorkspaceAs';
static LABEL = nls.localize('saveWorkspaceAsAction', "Save Workspace As...");
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
const workspacesCategory = nls.localize('workspaces', "Workspaces");
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 OpenWorkspaceAction extends Action {
static readonly ID = 'workbench.action.openWorkspace';
static LABEL = nls.localize('openWorkspaceAction', "Open Workspace...");
constructor(
id: string,
label: string,
@IFileDialogService private readonly dialogService: IFileDialogService
) {
super(id, label);
}
run(event?: any, data?: ITelemetryData): Promise<any> {
return this.dialogService.pickWorkspaceAndOpen({ telemetryExtraData: data });
}
}
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();
}
}
export class OpenWorkspaceConfigFileAction extends Action {
static readonly ID = 'workbench.action.openWorkspaceConfigFile';
static readonly LABEL = nls.localize('openWorkspaceConfigFile', "Open Workspace Configuration File");
constructor(
id: string,
label: string,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IEditorService private readonly editorService: IEditorService
) {
super(id, label);
this.enabled = !!this.workspaceContextService.getWorkspace().configuration;
}
run(): Promise<any> {
const configuration = this.workspaceContextService.getWorkspace().configuration;
if (configuration) {
return this.editorService.openEditor({ resource: configuration });
}
return Promise.resolve();
}
}
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 });
}
}
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, SupportsWorkspacesContext);
// --- Menu Registration
const workspacesCategory = nls.localize('workspaces', "Workspaces");
CommandsRegistry.registerCommand(OpenWorkspaceConfigFileAction.ID, serviceAccessor => {
serviceAccessor.get(IInstantiationService).createInstance(OpenWorkspaceConfigFileAction, OpenWorkspaceConfigFileAction.ID, OpenWorkspaceConfigFileAction.LABEL).run();
});
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.CommandPalette, {
command: {
id: OpenWorkspaceConfigFileAction.ID,

View File

@@ -141,8 +141,10 @@ export class WorkbenchContextKeysHandler extends Disposable {
// Development
IsDevelopmentContext.bindTo(this.contextKeyService).set(!this.environmentService.isBuilt || this.environmentService.isExtensionDevelopment);
// File Pickers
SupportsWorkspacesContext.bindTo(this.contextKeyService);
// Workspaces Support
// - web: only if already in workspace state
// - desktop: always
SupportsWorkspacesContext.bindTo(this.contextKeyService).set(isWeb ? this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE : true);
// Editors
this.activeEditorContext = ActiveEditorContext.bindTo(this.contextKeyService);

View File

@@ -43,20 +43,20 @@ export class WorkbenchLegacyLayout extends Disposable implements IVerticalSashLa
private static readonly sashYHeightSettingsKey = 'workbench.panel.height';
private static readonly panelSizeBeforeMaximizedKey = 'workbench.panel.sizeBeforeMaximized';
private workbenchSize: Dimension;
private workbenchSize!: Dimension;
private sashXOne: Sash;
private sashXTwo: Sash;
private sashY: Sash;
private _sidebarWidth: number;
private sidebarHeight: number;
private titlebarHeight: number;
private statusbarHeight: number;
private panelSizeBeforeMaximized: number;
private panelMaximized: boolean;
private _panelHeight: number;
private _panelWidth: number;
private _sidebarWidth!: number;
private sidebarHeight!: number;
private titlebarHeight!: number;
private statusbarHeight!: number;
private panelSizeBeforeMaximized!: number;
private panelMaximized!: boolean;
private _panelHeight!: number;
private _panelWidth!: number;
constructor(
private parent: HTMLElement,
@@ -413,7 +413,7 @@ export class WorkbenchLegacyLayout extends Disposable implements IVerticalSashLa
this.titlebarHeight = isTitlebarHidden ? 0 : this.partLayoutInfo.titlebar.height / (isMacintosh || !menubarVisibility || menubarVisibility === 'hidden' ? getZoomFactor() : 1); // adjust for zoom prevention
this.sidebarHeight = this.workbenchSize.height - this.statusbarHeight - this.titlebarHeight;
let sidebarSize = new Dimension(this.sidebarWidth, this.sidebarHeight);
let sidebarSize = { width: this.sidebarWidth, height: this.sidebarHeight };
// Activity Bar
let activityBarSize = new Dimension(this.activitybarWidth, sidebarSize.height);
@@ -463,7 +463,7 @@ export class WorkbenchLegacyLayout extends Disposable implements IVerticalSashLa
this.storageService.store(WorkbenchLegacyLayout.panelSizeBeforeMaximizedKey, this.panelSizeBeforeMaximized, StorageScope.GLOBAL);
const panelDimension = new Dimension(panelWidth, panelHeight);
const panelDimension = { width: panelWidth, height: panelHeight };
// Editor
let editorSize = {

View File

@@ -14,7 +14,7 @@
.windows { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
.windows:lang(zh-Hans) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
.windows:lang(zh-Hant) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
.windows:lang(ja) { font-family: "Segoe WPC", "Segoe UI", "Meiryo", sans-serif; }
.windows:lang(ja) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
.windows:lang(ko) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }
.linux { font-family: "Ubuntu", "Droid Sans", sans-serif; }
@@ -23,7 +23,7 @@
.linux:lang(ja) { font-family: "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
.linux:lang(ko) { font-family: "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
.mac { --monaco-monospace-font: Monaco, Menlo, Inconsolata, "Courier New", monospace; }
.mac { --monaco-monospace-font: "SF Mono", Monaco, Menlo, Inconsolata, "Courier New", monospace; }
.windows { --monaco-monospace-font: Consolas, Inconsolata, "Courier New", monospace; }
.linux { --monaco-monospace-font: "Droid Sans Mono", Inconsolata, "Courier New", monospace, "Droid Sans Fallback"; }

View File

@@ -156,13 +156,14 @@ class PartLayout {
titleSize = new Dimension(0, 0);
}
// Content Size: Width (Fill), Height (Variable)
const contentSize = new Dimension(width, height - titleSize.height);
let contentWidth = width;
if (this.options && typeof this.options.borderWidth === 'function') {
contentSize.width -= this.options.borderWidth(); // adjust for border size
contentWidth -= this.options.borderWidth(); // adjust for border size
}
// Content Size: Width (Fill), Height (Variable)
const contentSize = new Dimension(contentWidth, height - titleSize.height);
// Content
if (this.contentArea) {
size(this.contentArea, contentSize.width, contentSize.height);

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.97603 10.0719L12.3333 5.7146L12.9521 6.33332L8.28539 11L7.66667 11L3 6.33332L3.61872 5.7146L7.97603 10.0719Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 282 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.97603 10.0719L12.3333 5.7146L12.9521 6.33332L8.28539 11L7.66667 11L3 6.33332L3.61872 5.7146L7.97603 10.0719Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 280 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.97603 10.0719L12.3333 5.7146L12.9521 6.33332L8.28539 11L7.66667 11L3 6.33332L3.61872 5.7146L7.97603 10.0719Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 282 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.92809 7.97603L10.2854 12.3333L9.66668 12.9521L5.00001 8.28539V7.66667L9.66668 3L10.2854 3.61872L5.92809 7.97603Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 286 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.92809 7.97603L10.2854 12.3333L9.66668 12.9521L5.00001 8.28539V7.66667L9.66668 3L10.2854 3.61872L5.92809 7.97603Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 284 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.92809 7.97603L10.2854 12.3333L9.66668 12.9521L5.00001 8.28539V7.66667L9.66668 3L10.2854 3.61872L5.92809 7.97603Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 286 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0719 7.99999L5.7146 12.3573L6.33332 12.976L11 8.30935V7.69063L6.33332 3.02396L5.7146 3.64268L10.0719 7.99999Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 284 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0719 7.99999L5.7146 12.3573L6.33332 12.976L11 8.30935V7.69063L6.33332 3.02396L5.7146 3.64268L10.0719 7.99999Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 282 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0719 7.99999L5.7146 12.3573L6.33332 12.976L11 8.30935V7.69063L6.33332 3.02396L5.7146 3.64268L10.0719 7.99999Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 284 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 6.04042L3.02022 11.0202L2.31311 10.3131L7.64644 4.97976L8.35355 4.97976L13.6869 10.3131L12.9798 11.0202L8 6.04042Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 288 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 6.04042L3.02022 11.0202L2.31311 10.3131L7.64644 4.97976L8.35355 4.97976L13.6869 10.3131L12.9798 11.0202L8 6.04042Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 286 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 6.04042L3.02022 11.0202L2.31311 10.3131L7.64644 4.97976L8.35355 4.97976L13.6869 10.3131L12.9798 11.0202L8 6.04042Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 288 B

View File

@@ -1,4 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 4L12 12" stroke="#C5C5C5"/>
<path d="M12 4L4 12" stroke="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 183 B

View File

@@ -1,4 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 4L12 12" stroke="white"/>
<path d="M12 4L4 12" stroke="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 179 B

View File

@@ -1,4 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 4L12 12" stroke="#424242"/>
<path d="M12 4L4 12" stroke="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 183 B

View File

@@ -123,69 +123,3 @@
min-width: 110px;
margin-right: 10px;
}
/* Close */
.monaco-workbench .hide-panel-action {
background: url('close-light.svg') center center no-repeat;
}
.vs-dark .monaco-workbench .hide-panel-action {
background: url('close-dark.svg') center center no-repeat;
}
.hc-black .monaco-workbench .hide-panel-action {
background: url('close-hc.svg') center center no-repeat;
}
/* Up */
.monaco-workbench .maximize-panel-action {
background-image: url('chevron-up-light.svg');
}
.vs-dark .monaco-workbench .maximize-panel-action {
background-image: url('chevron-up-dark.svg');
}
.hc-black .monaco-workbench .maximize-panel-action {
background-image: url('chevron-up-hc.svg');
}
/* Down */
.monaco-workbench .minimize-panel-action {
background-image: url('chevron-down-light.svg');
}
.vs-dark .monaco-workbench .minimize-panel-action {
background-image: url('chevron-down-dark.svg');
}
.hc-black .monaco-workbench .minimize-panel-action {
background-image: url('chevron-down-hc.svg');
}
/* Left */
.monaco-workbench .panel.right .maximize-panel-action {
background-image: url('chevron-left-light.svg');
}
.vs-dark .monaco-workbench .panel.right .maximize-panel-action {
background-image: url('chevron-left-dark.svg');
}
.hc-black .monaco-workbench .panel.right .maximize-panel-action {
background-image: url('chevron-left-hc.svg');
}
/* Right */
.monaco-workbench .panel.right .minimize-panel-action {
background-image: url('chevron-right-light.svg');
}
.vs-dark .monaco-workbench .panel.right .minimize-panel-action {
background-image: url('chevron-right-dark.svg');
}
.hc-black .monaco-workbench .panel.right .minimize-panel-action {
background-image: url('chevron-right-hc.svg');
}

View File

@@ -28,7 +28,7 @@ export class ClosePanelAction extends Action {
name: string,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, name, 'hide-panel-action');
super(id, name, 'codicon-close');
}
run(): Promise<any> {
@@ -141,11 +141,11 @@ export class ToggleMaximizedPanelAction extends Action {
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IEditorGroupsService editorGroupsService: IEditorGroupsService
) {
super(id, label, layoutService.isPanelMaximized() ? 'minimize-panel-action' : 'maximize-panel-action');
super(id, label, layoutService.isPanelMaximized() ? 'codicon-chevron-down' : 'codicon-chevron-up');
this.toDispose.add(editorGroupsService.onDidLayout(() => {
const maximized = this.layoutService.isPanelMaximized();
this.class = maximized ? 'minimize-panel-action' : 'maximize-panel-action';
this.class = maximized ? 'codicon-chevron-down' : 'codicon-chevron-up';
this.label = maximized ? ToggleMaximizedPanelAction.RESTORE_LABEL : ToggleMaximizedPanelAction.MAXIMIZE_LABEL;
}));
}

View File

@@ -4,18 +4,17 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/titlebarpart';
import { dirname, posix } from 'vs/base/common/path';
import * as resources from 'vs/base/common/resources';
import { Part } from 'vs/workbench/browser/part';
import { ITitleService, ITitleProperties } from 'vs/workbench/services/title/common/titleService';
import { getZoomFactor } from 'vs/base/browser/browser';
import { IWindowService, IWindowsService, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IWindowService, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { IAction, Action } from 'vs/base/common/actions';
import { IAction } from 'vs/base/common/actions';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { DisposableStore, dispose } from 'vs/base/common/lifecycle';
import * as nls from 'vs/nls';
import { EditorInput, toResource, Verbosity, SideBySideEditor } from 'vs/workbench/common/editor';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
@@ -29,7 +28,7 @@ import { trim } from 'vs/base/common/strings';
import { EventType, EventHelper, Dimension, isAncestor, hide, show, removeClass, addClass, append, $, addDisposableListener, runAtThisOrScheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
import { CustomMenubarControl } from 'vs/workbench/browser/parts/titlebar/menubarControl';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { template, getBaseLabel } from 'vs/base/common/labels';
import { template } from 'vs/base/common/labels';
import { ILabelService } from 'vs/platform/label/common/label';
import { Event, Emitter } from 'vs/base/common/event';
import { IStorageService } from 'vs/platform/storage/common/storage';
@@ -37,6 +36,9 @@ import { Parts, IWorkbenchLayoutService } from 'vs/workbench/services/layout/bro
import { RunOnceScheduler } from 'vs/base/common/async';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { Schemas } from 'vs/base/common/network';
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IMenuService, IMenu, MenuId } from 'vs/platform/actions/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
export class TitlebarPart extends Part implements ITitleService {
@@ -71,7 +73,6 @@ export class TitlebarPart extends Part implements ITitleService {
private lastLayoutDimensions: Dimension;
private pendingTitle: string;
private representedFileName: string;
private isInactive: boolean;
@@ -80,11 +81,12 @@ export class TitlebarPart extends Part implements ITitleService {
private titleUpdater: RunOnceScheduler = this._register(new RunOnceScheduler(() => this.doUpdateTitle(), 0));
private contextMenu: IMenu;
constructor(
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IWindowService private readonly windowService: IWindowService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IWindowsService private readonly windowsService: IWindowsService,
@IEditorService private readonly editorService: IEditorService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@@ -92,10 +94,14 @@ export class TitlebarPart extends Part implements ITitleService {
@IThemeService themeService: IThemeService,
@ILabelService private readonly labelService: ILabelService,
@IStorageService storageService: IStorageService,
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@IMenuService menuService: IMenuService,
@IContextKeyService contextKeyService: IContextKeyService
) {
super(Parts.TITLEBAR_PART, { hasTitle: false }, themeService, storageService, layoutService);
this.contextMenu = this._register(menuService.createMenu(MenuId.TitleBarContext, contextKeyService));
this.registerListeners();
}
@@ -181,9 +187,6 @@ export class TitlebarPart extends Part implements ITitleService {
// Apply to window
this.windowService.setRepresentedFilename(path);
// Keep for context menu
this.representedFileName = path;
}
private doUpdateTitle(): void {
@@ -254,6 +257,7 @@ export class TitlebarPart extends Part implements ITitleService {
* {folderName}: e.g. myFolder
* {folderPath}: e.g. /Users/Development/myFolder
* {appName}: e.g. VS Code
* {remoteName}: e.g. SSH
* {dirty}: indicator
* {separator}: conditional separator
*/
@@ -294,6 +298,7 @@ export class TitlebarPart extends Part implements ITitleService {
const folderPath = folder ? this.labelService.getUriLabel(folder.uri) : '';
const dirty = editor && editor.isDirty() ? TitlebarPart.TITLE_DIRTY : '';
const appName = this.environmentService.appNameLong;
const remoteName = this.environmentService.configuration.remoteAuthority;
const separator = TitlebarPart.TITLE_SEPARATOR;
const titleTemplate = this.configurationService.getValue<string>('window.title');
@@ -310,6 +315,7 @@ export class TitlebarPart extends Part implements ITitleService {
folderPath,
dirty,
appName,
remoteName,
separator: { label: separator }
});
}
@@ -376,7 +382,6 @@ export class TitlebarPart extends Part implements ITitleService {
if (!isMacintosh && !isWeb) {
this.windowControls = append(this.element, $('div.window-controls-container'));
// Minimize
const minimizeIconContainer = append(this.windowControls, $('div.window-icon-bg'));
const minimizeIcon = append(minimizeIconContainer, $('div.window-icon'));
@@ -503,44 +508,16 @@ export class TitlebarPart extends Part implements ITitleService {
const event = new StandardMouseEvent(e);
const anchor = { x: event.posx, y: event.posy };
// Show menu
const actions = this.getContextMenuActions();
if (actions.length) {
this.contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => actions,
onHide: () => actions.forEach(a => a.dispose())
});
}
}
private getContextMenuActions(): IAction[] {
// Fill in contributed actions
const actions: IAction[] = [];
const actionsDisposable = createAndFillInContextMenuActions(this.contextMenu, undefined, actions, this.contextMenuService);
if (this.representedFileName) {
const segments = this.representedFileName.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);
}
actions.push(new ShowItemInFolderAction(path, label || posix.sep, this.windowsService));
}
}
return actions;
// Show it
this.contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => actions,
onHide: () => dispose(actionsDisposable)
});
}
private adjustTitleMarginToCenter(): void {
@@ -605,17 +582,6 @@ export class TitlebarPart extends Part implements ITitleService {
}
}
class ShowItemInFolderAction extends Action {
constructor(private path: string, label: string, private windowsService: IWindowsService) {
super('showItemInFolder.action.id', label);
}
run(): Promise<void> {
return this.windowsService.showItemInFolder(URI.file(this.path));
}
}
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const titlebarActiveFg = theme.getColor(TITLE_BAR_ACTIVE_FOREGROUND);
if (titlebarActiveFg) {

View File

@@ -768,6 +768,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
}
templateData.icon.style.backgroundImage = iconUrl ? DOM.asCSSUrl(iconUrl) : '';
templateData.icon.title = title ? title : '';
DOM.toggleClass(templateData.icon, 'custom-view-tree-node-item-icon', !!iconUrl);
templateData.actionBar.context = <TreeViewItemHandleArg>{ $treeViewId: this.treeViewId, $treeItemHandle: node.handle };
templateData.actionBar.push(this.menus.getResourceActions(node), { icon: true, label: false });

View File

@@ -6,11 +6,17 @@
import 'vs/css!./media/style';
import { registerThemingParticipant, ITheme, ICssStyleCollector, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
import { foreground, selectionBackground, focusBorder, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, listHighlightForeground, inputPlaceholderForeground } from 'vs/platform/theme/common/colorRegistry';
import { iconForeground, foreground, selectionBackground, focusBorder, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, listHighlightForeground, inputPlaceholderForeground } from 'vs/platform/theme/common/colorRegistry';
import { WORKBENCH_BACKGROUND } from 'vs/workbench/common/theme';
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
// Icon defaults
const iconForegroundColor = theme.getColor(iconForeground);
if (iconForegroundColor) {
collector.addRule(`.monaco-workbench .codicon { color: ${iconForegroundColor}; }`);
}
// Foreground
const windowForeground = theme.getColor(foreground);
if (windowForeground) {
@@ -136,4 +142,5 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
}
`);
}
});

View File

@@ -13,8 +13,8 @@ import { Workbench } from 'vs/workbench/browser/workbench';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IProductService } from 'vs/platform/product/common/product';
import product from 'vs/platform/product/browser/product';
import { IProductService } from 'vs/platform/product/common/productService';
import product from 'vs/platform/product/common/product';
import { RemoteAgentService } from 'vs/workbench/services/remote/browser/remoteAgentServiceImpl';
import { RemoteAuthorityResolverService } from 'vs/platform/remote/browser/remoteAuthorityResolverService';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
@@ -39,7 +39,7 @@ import { joinPath } from 'vs/base/common/resources';
import { BrowserStorageService } from 'vs/platform/storage/browser/storageService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { getThemeTypeSelector, DARK, HIGH_CONTRAST, LIGHT } from 'vs/platform/theme/common/themeService';
import { InMemoryUserDataProvider } from 'vs/workbench/services/userData/common/inMemoryUserDataProvider';
import { InMemoryFileSystemProvider } from 'vs/workbench/services/userData/common/inMemoryUserDataProvider';
import { registerWindowDriver } from 'vs/platform/driver/browser/driver';
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
import { FileLogService } from 'vs/platform/log/common/fileLogService';
@@ -75,6 +75,11 @@ class CodeRendererMain extends Disposable {
// Layout
this._register(addDisposableListener(window, EventType.RESIZE, () => workbench.layout()));
// Prevent the back/forward gestures in macOS
this._register(addDisposableListener(this.domElement, EventType.WHEEL, (e) => {
e.preventDefault();
}, { passive: false }));
// Workbench Lifecycle
this._register(workbench.onBeforeShutdown(event => {
if (services.storageService.hasPendingUpdate) {
@@ -222,7 +227,7 @@ class CodeRendererMain extends Disposable {
// User data
if (!this.configuration.userDataProvider) {
this.configuration.userDataProvider = this._register(new InMemoryUserDataProvider());
this.configuration.userDataProvider = this._register(new InMemoryFileSystemProvider());
}
fileService.registerProvider(Schemas.userData, this.configuration.userDataProvider);
}
@@ -261,12 +266,12 @@ class CodeRendererMain extends Disposable {
// Multi-root workspace
if (this.configuration.workspaceUri) {
return { id: hash(URI.revive(this.configuration.workspaceUri).toString()).toString(16), configPath: URI.revive(this.configuration.workspaceUri) };
return { id: hash(this.configuration.workspaceUri.toString()).toString(16), configPath: this.configuration.workspaceUri };
}
// Single-folder workspace
if (this.configuration.folderUri) {
return { id: hash(URI.revive(this.configuration.folderUri).toString()).toString(16), folder: URI.revive(this.configuration.folderUri) };
return { id: hash(this.configuration.folderUri.toString()).toString(16), folder: this.configuration.folderUri };
}
return { id: 'empty-window' };

View File

@@ -11,7 +11,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { Disposable } from 'vs/base/common/lifecycle';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IWindowService, INativeOpenDialogOptions, IEnterWorkspaceResult, IURIToOpen, IMessageBoxResult, IWindowsService, IOpenSettings, IWindowSettings } from 'vs/platform/windows/common/windows';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, IWorkspaceFolderCreationData, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IRecentlyOpened, IRecent, isRecentFile, isRecentFolder } from 'vs/platform/history/common/history';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
@@ -23,11 +23,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { IProcessEnvironment } from 'vs/base/common/platform';
import { toStoreData, restoreRecentlyOpened } from 'vs/platform/history/common/historyStorage';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IProductService } from 'vs/platform/product/common/product';
import Severity from 'vs/base/common/severity';
import { localize } from 'vs/nls';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
//#region Window
@@ -246,7 +241,7 @@ export class SimpleWindowService extends Disposable implements IWindowService {
for (let i = 0; i < _uris.length; i++) {
const uri = _uris[i];
if ('folderUri' in uri) {
const newAddress = `${document.location.origin}/?folder=${uri.folderUri.path}`;
const newAddress = `${document.location.origin}${document.location.pathname}?folder=${uri.folderUri.path}`;
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
@@ -254,7 +249,7 @@ export class SimpleWindowService extends Disposable implements IWindowService {
}
}
if ('workspaceUri' in uri) {
const newAddress = `${document.location.origin}/?workspace=${uri.workspaceUri.path}`;
const newAddress = `${document.location.origin}${document.location.pathname}?workspace=${uri.workspaceUri.path}`;
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
@@ -323,8 +318,6 @@ registerSingleton(IWindowService, SimpleWindowService);
export class SimpleWindowsService implements IWindowsService {
_serviceBrand: undefined;
windowCount = 1;
readonly onWindowOpen: Event<number> = Event.None;
readonly onWindowFocus: Event<number> = Event.None;
readonly onWindowBlur: Event<number> = Event.None;
@@ -332,13 +325,6 @@ export class SimpleWindowsService implements IWindowsService {
readonly onWindowUnmaximize: Event<number> = Event.None;
readonly onRecentlyOpenedChange: Event<void> = Event.None;
constructor(
@IDialogService private readonly dialogService: IDialogService,
@IProductService private readonly productService: IProductService,
@IClipboardService private readonly clipboardService: IClipboardService
) {
}
isFocused(_windowId: number): Promise<boolean> {
return Promise.resolve(true);
}
@@ -466,49 +452,6 @@ export class SimpleWindowsService implements IWindowsService {
}
openExtensionDevelopmentHostWindow(args: ParsedArgs, env: IProcessEnvironment): Promise<void> {
// we pass the "ParsedArgs" as query parameters of the URL
let newAddress = `${document.location.origin}/?`;
let gotFolder = false;
const addQueryParameter = (key: string, value: string) => {
const lastChar = newAddress.charAt(newAddress.length - 1);
if (lastChar !== '?' && lastChar !== '&') {
newAddress += '&';
}
newAddress += `${key}=${encodeURIComponent(value)}`;
};
const f = args['folder-uri'];
if (f) {
const u = URI.parse(f[0]);
gotFolder = true;
addQueryParameter('folder', u.path);
}
if (!gotFolder) {
// request empty window
addQueryParameter('ew', 'true');
}
const ep = args['extensionDevelopmentPath'];
if (ep) {
let u = ep[0];
addQueryParameter('edp', u);
}
const di = args['debugId'];
if (di) {
addQueryParameter('di', di);
}
const ibe = args['inspect-brk-extensions'];
if (ibe) {
addQueryParameter('ibe', ibe);
}
window.open(newAddress);
return Promise.resolve();
}
@@ -516,18 +459,6 @@ export class SimpleWindowsService implements IWindowsService {
return Promise.resolve([]);
}
getWindowCount(): Promise<number> {
return Promise.resolve(this.windowCount);
}
log(_severity: string, _args: string[]): Promise<void> {
return Promise.resolve();
}
showItemInFolder(_path: URI): Promise<void> {
return Promise.resolve();
}
newWindowTab(): Promise<void> {
return Promise.resolve();
}
@@ -585,22 +516,6 @@ export class SimpleWindowsService implements IWindowsService {
throw new Error('not implemented');
}
async openAboutDialog(): Promise<void> {
const detail = localize('aboutDetail',
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
this.productService.version || 'Unknown',
this.productService.commit || 'Unknown',
this.productService.date || 'Unknown',
navigator.userAgent
);
const { choice } = await this.dialogService.show(Severity.Info, this.productService.nameLong, [localize('copy', "Copy"), localize('ok', "OK")], { detail });
if (choice === 0) {
this.clipboardService.writeText(detail);
}
}
resolveProxy(windowId: number, url: string): Promise<string | undefined> {
return Promise.resolve(undefined);
}
@@ -609,28 +524,3 @@ export class SimpleWindowsService implements IWindowsService {
registerSingleton(IWindowsService, SimpleWindowsService);
//#endregion
//#region Workspaces
export class SimpleWorkspacesService implements IWorkspacesService {
_serviceBrand: undefined;
createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[], remoteAuthority?: string): Promise<IWorkspaceIdentifier> {
// @ts-ignore
return Promise.resolve(undefined);
}
deleteUntitledWorkspace(workspace: IWorkspaceIdentifier): Promise<void> {
return Promise.resolve(undefined);
}
getWorkspaceIdentifier(workspacePath: URI): Promise<IWorkspaceIdentifier> {
// @ts-ignore
return Promise.resolve(undefined);
}
}
registerSingleton(IWorkspacesService, SimpleWorkspacesService);
//#endregion

View File

@@ -6,7 +6,7 @@
import { Registry } from 'vs/platform/registry/common/platform';
import * as nls from 'vs/nls';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform';
import { isMacintosh, isWindows, isLinux, isWeb, isNative } from 'vs/base/common/platform';
// Configuration
(function registerConfiguration(): void {
@@ -263,6 +263,7 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'
nls.localize('rootName', "`\${rootName}`: name of the workspace (e.g. myFolder or myWorkspace)."),
nls.localize('rootPath', "`\${rootPath}`: file path of the workspace (e.g. /Users/Development/myWorkspace)."),
nls.localize('appName', "`\${appName}`: e.g. VS Code."),
nls.localize('remoteName', "`\${remoteName}`: e.g. SSH"),
nls.localize('dirty', "`\${dirty}`: a dirty indicator if the active editor is dirty."),
nls.localize('separator', "`\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.")
].join('\n- '); // intentionally concatenated to not produce a string that is too long for translations
@@ -275,7 +276,18 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'
'properties': {
'window.title': {
'type': 'string',
'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}',
'default': (() => {
if (isMacintosh && isNative) {
return '${activeEditorShort}${separator}${rootName}'; // macOS has native dirty indicator
}
const base = '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}';
if (isWeb) {
return base + '${separator}${remoteName}'; // Web: always show remote indicator
}
return base;
})(),
'markdownDescription': windowTitleDescription
},
'window.menuBarVisibility': {