Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -21,12 +21,11 @@ import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { IExtensionManagementService, LocalExtensionType, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionManagementService, LocalExtensionType, ILocalExtension, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import paths = require('vs/base/common/paths');
import { isMacintosh, isLinux } from 'vs/base/common/platform';
import { IQuickOpenService, IFilePickOpenEntry, ISeparator, IPickOpenAction, IPickOpenItem } from 'vs/platform/quickOpen/common/quickOpen';
import { KeyMod } from 'vs/base/common/keyCodes';
import { isMacintosh, isLinux, language } from 'vs/base/common/platform';
import { IQuickOpenService, IFilePickOpenEntry, ISeparator, IPickOpenAction, IPickOpenItem, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
import * as browser from 'vs/base/browser/browser';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
import { IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen';
@@ -38,20 +37,23 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import * as os from 'os';
import { webFrame } from 'electron';
import { getPathLabel } from 'vs/base/common/labels';
import { getPathLabel, getBaseLabel } from 'vs/base/common/labels';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { IPanel } from 'vs/workbench/common/panel';
import { IWorkspaceIdentifier, getWorkspaceLabel, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { FileKind } from 'vs/platform/files/common/files';
import { FileKind, IFileService } from 'vs/platform/files/common/files';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { IExtensionService, ActivationTimes } from 'vs/platform/extensions/common/extensions';
import { getEntries } from 'vs/base/common/performance';
import { IEditor } from 'vs/platform/editor/common/editor';
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
// --- actions
export class CloseEditorAction extends Action {
public static ID = 'workbench.action.closeActiveEditor';
public static LABEL = nls.localize('closeActiveEditor', "Close Editor");
public static readonly ID = 'workbench.action.closeActiveEditor';
public static readonly LABEL = nls.localize('closeActiveEditor', "Close Editor");
constructor(
id: string,
@@ -73,8 +75,8 @@ export class CloseEditorAction extends Action {
export class CloseCurrentWindowAction extends Action {
public static ID = 'workbench.action.closeWindow';
public static LABEL = nls.localize('closeWindow', "Close Window");
public static readonly ID = 'workbench.action.closeWindow';
public static readonly LABEL = nls.localize('closeWindow', "Close Window");
constructor(id: string, label: string, @IWindowService private windowService: IWindowService) {
super(id, label);
@@ -150,12 +152,11 @@ export class ToggleMenuBarAction extends Action {
static ID = 'workbench.action.toggleMenuBar';
static LABEL = nls.localize('toggleMenuBar', "Toggle Menu Bar");
private static menuBarVisibilityKey = 'window.menuBarVisibility';
private static readonly menuBarVisibilityKey = 'window.menuBarVisibility';
constructor(
id: string,
label: string,
@IMessageService private messageService: IMessageService,
@IConfigurationService private configurationService: IConfigurationService
) {
super(id, label);
@@ -195,7 +196,7 @@ export class ToggleDevToolsAction extends Action {
}
export abstract class BaseZoomAction extends Action {
private static SETTING_KEY = 'window.zoomLevel';
private static readonly SETTING_KEY = 'window.zoomLevel';
constructor(
id: string,
@@ -223,8 +224,8 @@ export abstract class BaseZoomAction extends Action {
export class ZoomInAction extends BaseZoomAction {
public static ID = 'workbench.action.zoomIn';
public static LABEL = nls.localize('zoomIn', "Zoom In");
public static readonly ID = 'workbench.action.zoomIn';
public static readonly LABEL = nls.localize('zoomIn', "Zoom In");
constructor(
id: string,
@@ -243,8 +244,8 @@ export class ZoomInAction extends BaseZoomAction {
export class ZoomOutAction extends BaseZoomAction {
public static ID = 'workbench.action.zoomOut';
public static LABEL = nls.localize('zoomOut', "Zoom Out");
public static readonly ID = 'workbench.action.zoomOut';
public static readonly LABEL = nls.localize('zoomOut', "Zoom Out");
constructor(
id: string,
@@ -263,8 +264,8 @@ export class ZoomOutAction extends BaseZoomAction {
export class ZoomResetAction extends BaseZoomAction {
public static ID = 'workbench.action.zoomReset';
public static LABEL = nls.localize('zoomReset', "Reset Zoom");
public static readonly ID = 'workbench.action.zoomReset';
public static readonly LABEL = nls.localize('zoomReset', "Reset Zoom");
constructor(
id: string,
@@ -307,8 +308,8 @@ interface ILoaderEvent {
export class ShowStartupPerformance extends Action {
public static ID = 'workbench.action.appPerf';
public static LABEL = nls.localize('appPerf', "Startup Performance");
public static readonly ID = 'workbench.action.appPerf';
public static readonly LABEL = nls.localize('appPerf', "Startup Performance");
constructor(
id: string,
@@ -340,11 +341,9 @@ export class ShowStartupPerformance extends Action {
console.log(`Empty Workspace: ${metrics.emptyWorkbench}`);
let nodeModuleLoadTime: number;
let nodeModuleLoadDetails: any[];
if (this.environmentService.performance) {
const nodeModuleTimes = this.analyzeNodeModulesLoadTimes();
nodeModuleLoadTime = nodeModuleTimes.duration;
nodeModuleLoadDetails = nodeModuleTimes.table;
}
(<any>console).table(this.getStartupMetricsTable(nodeModuleLoadTime));
@@ -361,7 +360,25 @@ export class ShowStartupPerformance extends Action {
(<any>console).groupEnd();
(<any>console).group('Extension Activation Stats');
(<any>console).table(this.extensionService.getExtensionsActivationTimes());
let extensionsActivationTimes: { [id: string]: ActivationTimes; } = {};
let extensionsStatus = this.extensionService.getExtensionsStatus();
for (let id in extensionsStatus) {
const status = extensionsStatus[id];
if (status.activationTimes) {
extensionsActivationTimes[id] = status.activationTimes;
}
}
(<any>console).table(extensionsActivationTimes);
(<any>console).groupEnd();
(<any>console).group('Raw Startup Timers (CSV)');
let value = `Name\tStart\tDuration\n`;
const entries = getEntries('measure');
let offset = entries[0].startTime;
for (const entry of entries) {
value += `${entry.name}\t${entry.startTime - offset}\t${entry.duration}\n`;
}
console.log(value);
(<any>console).groupEnd();
}, 1000);
@@ -431,7 +448,7 @@ export class ShowStartupPerformance extends Action {
}
private analyzeLoaderStats(): { [type: string]: any[] } {
const stats = <ILoaderEvent[]>(<any>require).getStats().slice(0).sort((a, b) => {
const stats = <ILoaderEvent[]>(<any>require).getStats().slice(0).sort((a: ILoaderEvent, b: ILoaderEvent) => {
if (a.detail < b.detail) {
return -1;
} else if (a.detail > b.detail) {
@@ -615,8 +632,8 @@ export abstract class BaseSwitchWindow extends Action {
class CloseWindowAction extends Action implements IPickOpenAction {
public static ID = 'workbench.action.closeWindow';
public static LABEL = nls.localize('close', "Close Window");
public static readonly ID = 'workbench.action.closeWindow';
public static readonly LABEL = nls.localize('close', "Close Window");
constructor(
@IWindowsService private windowsService: IWindowsService
@@ -715,7 +732,7 @@ export abstract class BaseOpenRecentAction extends Action {
let description: string;
if (isSingleFolderWorkspaceIdentifier(workspace)) {
path = workspace;
label = paths.basename(path);
label = getBaseLabel(path);
description = getPathLabel(paths.dirname(path), null, environmentService);
} else {
path = workspace.configPath;
@@ -741,7 +758,7 @@ export abstract class BaseOpenRecentAction extends Action {
}
const runPick = (path: string, isFile: boolean, context: IEntryRunContext) => {
const forceNewWindow = context.keymods.indexOf(KeyMod.CtrlCmd) >= 0;
const forceNewWindow = context.keymods.ctrlCmd;
this.windowsService.openWindow([path], { forceNewWindow, forceOpenWorkspaceAsFile: isFile });
};
@@ -769,8 +786,8 @@ export abstract class BaseOpenRecentAction extends Action {
class RemoveFromRecentlyOpened extends Action implements IPickOpenAction {
public static ID = 'workbench.action.removeFromRecentlyOpened';
public static LABEL = nls.localize('remove', "Remove from Recently Opened");
public static readonly ID = 'workbench.action.removeFromRecentlyOpened';
public static readonly LABEL = nls.localize('remove', "Remove from Recently Opened");
constructor(
@IWindowsService private windowsService: IWindowsService
@@ -791,8 +808,8 @@ class RemoveFromRecentlyOpened extends Action implements IPickOpenAction {
export class OpenRecentAction extends BaseOpenRecentAction {
public static ID = 'workbench.action.openRecent';
public static LABEL = nls.localize('openRecent', "Open Recent...");
public static readonly ID = 'workbench.action.openRecent';
public static readonly LABEL = nls.localize('openRecent', "Open Recent...");
constructor(
id: string,
@@ -815,8 +832,8 @@ export class OpenRecentAction extends BaseOpenRecentAction {
export class QuickOpenRecentAction extends BaseOpenRecentAction {
public static ID = 'workbench.action.quickOpenRecent';
public static LABEL = nls.localize('quickOpenRecent', "Quick Open Recent...");
public static readonly ID = 'workbench.action.quickOpenRecent';
public static readonly LABEL = nls.localize('quickOpenRecent', "Quick Open Recent...");
constructor(
id: string,
@@ -839,8 +856,8 @@ export class QuickOpenRecentAction extends BaseOpenRecentAction {
export class CloseMessagesAction extends Action {
public static ID = 'workbench.action.closeMessages';
public static LABEL = nls.localize('closeMessages', "Close Notification Messages");
public static readonly ID = 'workbench.action.closeMessages';
public static readonly LABEL = nls.localize('closeMessages', "Close Notification Messages");
constructor(
id: string,
@@ -868,14 +885,15 @@ export class CloseMessagesAction extends Action {
export class ReportIssueAction extends Action {
public static ID = 'workbench.action.reportIssues';
public static LABEL = nls.localize('reportIssues', "Report Issues");
public static readonly ID = 'workbench.action.reportIssues';
public static readonly LABEL = nls.localize({ key: 'reportIssueInEnglish', comment: ['Translate this to "Report Issue in English" in all languages please!'] }, "Report Issue");
constructor(
id: string,
label: string,
@IIntegrityService private integrityService: IIntegrityService,
@IExtensionManagementService private extensionManagementService: IExtensionManagementService,
@IExtensionEnablementService private extensionEnablementService: IExtensionEnablementService,
@IEnvironmentService private environmentService: IEnvironmentService
) {
super(id, label);
@@ -895,6 +913,7 @@ export class ReportIssueAction extends Action {
public run(): TPromise<boolean> {
return this._optimisticIsPure().then(isPure => {
return this.extensionManagementService.getInstalled(LocalExtensionType.User).then(extensions => {
extensions = extensions.filter(extension => this.extensionEnablementService.isEnabled(extension.identifier));
const issueUrl = this.generateNewIssueUrl(product.reportIssueUrl, pkg.name, pkg.version, product.commit, product.date, isPure, extensions, this.environmentService.disableExtensions);
window.open(issueUrl);
@@ -913,6 +932,7 @@ export class ReportIssueAction extends Action {
const body = encodeURIComponent(
`- SQL Operations Studio Version: ${name} ${version}${isPure ? '' : ' **[Unsupported]**'} (${product.commit || 'Commit unknown'}, ${product.date || 'Date unknown'})
- OS Version: ${osVersion}
- Extensions: ${areExtensionsDisabled ? 'Extensions are disabled' : this.generateExtensionTable(extensions)}
---
Steps to Reproduce:
@@ -967,8 +987,8 @@ ${themeExclusionStr}
export class ReportPerformanceIssueAction extends Action {
public static ID = 'workbench.action.reportPerformanceIssue';
public static LABEL = nls.localize('reportPerformanceIssue', "Report Performance Issue");
public static readonly ID = 'workbench.action.reportPerformanceIssue';
public static readonly LABEL = nls.localize('reportPerformanceIssue', "Report Performance Issue");
constructor(
id: string,
@@ -1087,11 +1107,11 @@ ${appendix}`
export class KeybindingsReferenceAction extends Action {
public static ID = 'workbench.action.keybindingsReference';
public static LABEL = nls.localize('keybindingsReference', "Keyboard Shortcuts Reference");
public static readonly ID = 'workbench.action.keybindingsReference';
public static readonly LABEL = nls.localize('keybindingsReference', "Keyboard Shortcuts Reference");
private static URL = isLinux ? product.keyboardShortcutsUrlLinux : isMacintosh ? product.keyboardShortcutsUrlMac : product.keyboardShortcutsUrlWin;
public static AVAILABLE = !!KeybindingsReferenceAction.URL;
private static readonly URL = isLinux ? product.keyboardShortcutsUrlLinux : isMacintosh ? product.keyboardShortcutsUrlMac : product.keyboardShortcutsUrlWin;
public static readonly AVAILABLE = !!KeybindingsReferenceAction.URL;
constructor(
id: string,
@@ -1108,11 +1128,11 @@ export class KeybindingsReferenceAction extends Action {
export class OpenDocumentationUrlAction extends Action {
public static ID = 'workbench.action.openDocumentationUrl';
public static LABEL = nls.localize('openDocumentationUrl', "Documentation");
public static readonly ID = 'workbench.action.openDocumentationUrl';
public static readonly LABEL = nls.localize('openDocumentationUrl', "Documentation");
private static URL = product.documentationUrl;
public static AVAILABLE = !!OpenDocumentationUrlAction.URL;
private static readonly URL = product.documentationUrl;
public static readonly AVAILABLE = !!OpenDocumentationUrlAction.URL;
constructor(
id: string,
@@ -1129,11 +1149,11 @@ export class OpenDocumentationUrlAction extends Action {
export class OpenIntroductoryVideosUrlAction extends Action {
public static ID = 'workbench.action.openIntroductoryVideosUrl';
public static LABEL = nls.localize('openIntroductoryVideosUrl', "Introductory Videos");
public static readonly ID = 'workbench.action.openIntroductoryVideosUrl';
public static readonly LABEL = nls.localize('openIntroductoryVideosUrl', "Introductory Videos");
private static URL = product.introductoryVideosUrl;
public static AVAILABLE = !!OpenIntroductoryVideosUrlAction.URL;
private static readonly URL = product.introductoryVideosUrl;
public static readonly AVAILABLE = !!OpenIntroductoryVideosUrlAction.URL;
constructor(
id: string,
@@ -1150,11 +1170,11 @@ export class OpenIntroductoryVideosUrlAction extends Action {
export class OpenTipsAndTricksUrlAction extends Action {
public static ID = 'workbench.action.openTipsAndTricksUrl';
public static LABEL = nls.localize('openTipsAndTricksUrl', "Tips and Tricks");
public static readonly ID = 'workbench.action.openTipsAndTricksUrl';
public static readonly LABEL = nls.localize('openTipsAndTricksUrl', "Tips and Tricks");
private static URL = product.tipsAndTricksUrl;
public static AVAILABLE = !!OpenTipsAndTricksUrlAction.URL;
private static readonly URL = product.tipsAndTricksUrl;
public static readonly AVAILABLE = !!OpenTipsAndTricksUrlAction.URL;
constructor(
id: string,
@@ -1295,8 +1315,8 @@ export abstract class BaseNavigationAction extends Action {
export class NavigateLeftAction extends BaseNavigationAction {
public static ID = 'workbench.action.navigateLeft';
public static LABEL = nls.localize('navigateLeft', "Navigate to the View on the Left");
public static readonly ID = 'workbench.action.navigateLeft';
public static readonly LABEL = nls.localize('navigateLeft', "Navigate to the View on the Left");
constructor(
id: string,
@@ -1348,8 +1368,8 @@ export class NavigateLeftAction extends BaseNavigationAction {
export class NavigateRightAction extends BaseNavigationAction {
public static ID = 'workbench.action.navigateRight';
public static LABEL = nls.localize('navigateRight', "Navigate to the View on the Right");
public static readonly ID = 'workbench.action.navigateRight';
public static readonly LABEL = nls.localize('navigateRight', "Navigate to the View on the Right");
constructor(
id: string,
@@ -1402,8 +1422,8 @@ export class NavigateRightAction extends BaseNavigationAction {
export class NavigateUpAction extends BaseNavigationAction {
public static ID = 'workbench.action.navigateUp';
public static LABEL = nls.localize('navigateUp', "Navigate to the View Above");
public static readonly ID = 'workbench.action.navigateUp';
public static readonly LABEL = nls.localize('navigateUp', "Navigate to the View Above");
constructor(
id: string,
@@ -1433,8 +1453,8 @@ export class NavigateUpAction extends BaseNavigationAction {
export class NavigateDownAction extends BaseNavigationAction {
public static ID = 'workbench.action.navigateDown';
public static LABEL = nls.localize('navigateDown', "Navigate to the View Below");
public static readonly ID = 'workbench.action.navigateDown';
public static readonly LABEL = nls.localize('navigateDown', "Navigate to the View Below");
constructor(
id: string,
@@ -1498,8 +1518,8 @@ export abstract class BaseResizeViewAction extends Action {
export class IncreaseViewSizeAction extends BaseResizeViewAction {
public static ID = 'workbench.action.increaseViewSize';
public static LABEL = nls.localize('increaseViewSize', "Increase Current View Size");
public static readonly ID = 'workbench.action.increaseViewSize';
public static readonly LABEL = nls.localize('increaseViewSize', "Increase Current View Size");
constructor(
id: string,
@@ -1517,8 +1537,8 @@ export class IncreaseViewSizeAction extends BaseResizeViewAction {
export class DecreaseViewSizeAction extends BaseResizeViewAction {
public static ID = 'workbench.action.decreaseViewSize';
public static LABEL = nls.localize('decreaseViewSize', "Decrease Current View Size");
public static readonly ID = 'workbench.action.decreaseViewSize';
public static readonly LABEL = nls.localize('decreaseViewSize', "Decrease Current View Size");
constructor(
id: string,
@@ -1537,8 +1557,8 @@ export class DecreaseViewSizeAction extends BaseResizeViewAction {
export class ShowPreviousWindowTab extends Action {
public static ID = 'workbench.action.showPreviousWindowTab';
public static LABEL = nls.localize('showPreviousTab', "Show Previous Window Tab");
public static readonly ID = 'workbench.action.showPreviousWindowTab';
public static readonly LABEL = nls.localize('showPreviousTab', "Show Previous Window Tab");
constructor(
id: string,
@@ -1555,8 +1575,8 @@ export class ShowPreviousWindowTab extends Action {
export class ShowNextWindowTab extends Action {
public static ID = 'workbench.action.showNextWindowTab';
public static LABEL = nls.localize('showNextWindowTab', "Show Next Window Tab");
public static readonly ID = 'workbench.action.showNextWindowTab';
public static readonly LABEL = nls.localize('showNextWindowTab', "Show Next Window Tab");
constructor(
id: string,
@@ -1573,8 +1593,8 @@ export class ShowNextWindowTab extends Action {
export class MoveWindowTabToNewWindow extends Action {
public static ID = 'workbench.action.moveWindowTabToNewWindow';
public static LABEL = nls.localize('moveWindowTabToNewWindow', "Move Window Tab to New Window");
public static readonly ID = 'workbench.action.moveWindowTabToNewWindow';
public static readonly LABEL = nls.localize('moveWindowTabToNewWindow', "Move Window Tab to New Window");
constructor(
id: string,
@@ -1591,8 +1611,8 @@ export class MoveWindowTabToNewWindow extends Action {
export class MergeAllWindowTabs extends Action {
public static ID = 'workbench.action.mergeAllWindowTabs';
public static LABEL = nls.localize('mergeAllWindowTabs', "Merge All Windows");
public static readonly ID = 'workbench.action.mergeAllWindowTabs';
public static readonly LABEL = nls.localize('mergeAllWindowTabs', "Merge All Windows");
constructor(
id: string,
@@ -1609,8 +1629,8 @@ export class MergeAllWindowTabs extends Action {
export class ToggleWindowTabsBar extends Action {
public static ID = 'workbench.action.toggleWindowTabsBar';
public static LABEL = nls.localize('toggleWindowTabsBar', "Toggle Window Tabs Bar");
public static readonly ID = 'workbench.action.toggleWindowTabsBar';
public static readonly LABEL = nls.localize('toggleWindowTabsBar', "Toggle Window Tabs Bar");
constructor(
id: string,
@@ -1623,4 +1643,124 @@ export class ToggleWindowTabsBar extends Action {
public run(): TPromise<boolean> {
return this.windowsService.toggleWindowTabsBar().then(() => true);
}
}
export class ConfigureLocaleAction extends Action {
public static readonly ID = 'workbench.action.configureLocale';
public static readonly LABEL = nls.localize('configureLocale', "Configure Language");
private static DEFAULT_CONTENT: string = [
'{',
`\t// ${nls.localize('displayLanguage', 'Defines VSCode\'s display language.')}`,
`\t// ${nls.localize('doc', 'See {0} for a list of supported languages.', 'https://go.microsoft.com/fwlink/?LinkId=761051')}`,
`\t// ${nls.localize('restart', 'Changing the value requires restarting VSCode.')}`,
`\t"locale":"${language}"`,
'}'
].join('\n');
constructor(id: string, label: string,
@IFileService private fileService: IFileService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
super(id, label);
}
public run(event?: any): TPromise<IEditor> {
const file = URI.file(paths.join(this.environmentService.appSettingsHome, 'locale.json'));
return this.fileService.resolveFile(file).then(null, (error) => {
return this.fileService.createFile(file, ConfigureLocaleAction.DEFAULT_CONTENT);
}).then((stat) => {
if (!stat) {
return undefined;
}
return this.editorService.openEditor({
resource: stat.resource,
options: {
forceOpen: true
}
});
}, (error) => {
throw new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", getPathLabel(file, this.contextService), error));
});
}
}
export class OpenLogsFolderAction extends Action {
static ID = 'workbench.action.openLogsFolder';
static LABEL = nls.localize('openLogsFolder', "Open Logs Folder");
constructor(id: string, label: string,
@IEnvironmentService private environmentService: IEnvironmentService,
@IWindowsService private windowsService: IWindowsService,
) {
super(id, label);
}
run(): TPromise<void> {
return this.windowsService.showItemInFolder(paths.join(this.environmentService.logsPath, 'main.log'));
}
}
export class ShowLogsAction extends Action {
static ID = 'workbench.action.showLogs';
static LABEL = nls.localize('showLogs', "Show Logs...");
constructor(id: string, label: string,
@IEnvironmentService private environmentService: IEnvironmentService,
@IWindowService private windowService: IWindowService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IQuickOpenService private quickOpenService: IQuickOpenService
) {
super(id, label);
}
run(): TPromise<void> {
const entries: IPickOpenEntry[] = [
{ id: 'main', label: nls.localize('mainProcess', "Main"), run: () => this.editorService.openEditor({ resource: URI.file(paths.join(this.environmentService.logsPath, 'main.log')) }) },
{ id: 'shared', label: nls.localize('sharedProcess', "Shared"), run: () => this.editorService.openEditor({ resource: URI.file(paths.join(this.environmentService.logsPath, 'sharedprocess.log')) }) },
{ id: 'renderer', label: nls.localize('rendererProcess', "Renderer"), run: () => this.editorService.openEditor({ resource: URI.file(paths.join(this.environmentService.logsPath, `renderer${this.windowService.getCurrentWindowId()}.log`)) }) },
{ id: 'extenshionHost', label: nls.localize('extensionHost', "Extension Host"), run: () => this.editorService.openEditor({ resource: URI.file(paths.join(this.environmentService.logsPath, `exthost${this.windowService.getCurrentWindowId()}.log`)) }) }
];
return this.quickOpenService.pick(entries, { placeHolder: nls.localize('selectProcess', "Select process") }).then(entry => {
if (entry) {
entry.run(null);
}
});
}
}
export class SetLogLevelAction extends Action {
static ID = 'workbench.action.setLogLevel';
static LABEL = nls.localize('setLogLevel', "Set Log Level");
constructor(id: string, label: string,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@ILogService private logService: ILogService
) {
super(id, label);
}
run(): TPromise<void> {
const entries = [
{ label: nls.localize('trace', "Trace"), level: LogLevel.Trace },
{ label: nls.localize('debug', "Debug"), level: LogLevel.Debug },
{ label: nls.localize('info', "Info"), level: LogLevel.Info },
{ label: nls.localize('warn', "Warning"), level: LogLevel.Warning },
{ label: nls.localize('err', "Error"), level: LogLevel.Error },
{ label: nls.localize('critical', "Critical"), level: LogLevel.Critical },
{ label: nls.localize('off', "Off"), level: LogLevel.Off }
];
return this.quickOpenService.pick(entries, { placeHolder: nls.localize('selectLogLevel', "Select log level"), autoFocus: { autoFocusIndex: this.logService.getLevel() } }).then(entry => {
if (entry) {
this.logService.setLevel(entry.level);
}
});
}
}

View File

@@ -7,14 +7,11 @@
'use strict';
if (window.location.search.indexOf('prof-startup') >= 0) {
var profiler = require('v8-profiler');
profiler.startProfiling('renderer', true);
}
/*global window,document,define*/
/*global window,document,define,Monaco_Loader_Init*/
const perf = require('../../../base/common/performance');
perf.mark('renderer/started');
const startTimer = require('../../../base/node/startupTimers').startTimer;
const path = require('path');
const electron = require('electron');
const remote = electron.remote;
@@ -60,6 +57,7 @@ function parseURLQueryArgs() {
.reduce(function (r, param) { r[param[0]] = decodeURIComponent(param[1]); return r; }, {});
}
// {{SQL CARBON EDIT}}
function createScript(src, onload) {
const script = document.createElement('script');
script.src = src;
@@ -131,7 +129,6 @@ require('zone.js');
const _ = require('underscore')._;
/* eslint-enable */
function main() {
const webFrame = require('electron').webFrame;
const args = parseURLQueryArgs();
@@ -139,6 +136,7 @@ function main() {
// Correctly inherit the parent's environment
assign(process.env, configuration.userEnv);
perf.importEntries(configuration.perfEntries);
// Get the nls configuration into the process.env as early as possible.
var nlsConfig = { availableLanguages: {} };
@@ -169,95 +167,86 @@ function main() {
webFrame.setZoomLevel(zoomLevel);
}
// {{SQL CARBON EDIT}}
// {{SQL CARBON EDIT}}
// Load the loader and start loading the workbench
const appRoot = uriFromPath(configuration.appRoot);
const rootUrl = appRoot + '/out';
createScript(appRoot + '/node_modules/chart.js/dist/Chart.js', undefined);
const loaderFilename = configuration.appRoot + '/out/vs/loader.js';
const loaderSource = require('fs').readFileSync(loaderFilename);
require('vm').runInThisContext(loaderSource, { filename: loaderFilename });
function onLoader() {
window.nodeRequire = require.__$__nodeRequire;
window.nodeRequire = require.__$__nodeRequire;
define('fs', ['original-fs'], function (originalFS) { return originalFS; }); // replace the patched electron fs with the original node fs for all AMD code
loaderTimer.stop();
define('fs', ['original-fs'], function (originalFS) { return originalFS; }); // replace the patched electron fs with the original node fs for all AMD code
window.MonacoEnvironment = {};
window.MonacoEnvironment = {};
const onNodeCachedData = window.MonacoEnvironment.onNodeCachedData = [];
require.config({
baseUrl: rootUrl,
'vs/nls': nlsConfig,
recordStats: !!configuration.performance,
nodeCachedDataDir: configuration.nodeCachedDataDir,
onNodeCachedData: function () { onNodeCachedData.push(arguments); },
nodeModules: [
'@angular/common',
'@angular/core',
'@angular/forms',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'angular2-grid',
'pretty-data',
'html-query-plan',
'ng2-charts/ng2-charts',
'rxjs/Observable',
'rxjs/Subject',
'rxjs/Observer'
]
});
const onNodeCachedData = window.MonacoEnvironment.onNodeCachedData = [];
if (nlsConfig.pseudo) {
require(['vs/nls'], function (nlsPlugin) {
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
});
}
// {{SQL CARBON EDIT}}
require.config({
baseUrl: uriFromPath(configuration.appRoot) + '/out',
'vs/nls': nlsConfig,
recordStats: !!configuration.performance,
nodeCachedDataDir: configuration.nodeCachedDataDir,
onNodeCachedData: function () { onNodeCachedData.push(arguments); },
nodeModules: [
'@angular/common',
'@angular/core',
'@angular/forms',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'angular2-grid',
'pretty-data',
'html-query-plan',
'ng2-charts/ng2-charts',
'rxjs/Observable',
'rxjs/Subject',
'rxjs/Observer'
]
});
// Perf Counters
const timers = window.MonacoEnvironment.timers = {
isInitialStartup: !!configuration.isInitialStartup,
hasAccessibilitySupport: !!configuration.accessibilitySupport,
start: configuration.perfStartTime,
appReady: configuration.perfAppReady,
windowLoad: configuration.perfWindowLoadTime,
beforeLoadWorkbenchMain: Date.now()
};
const workbenchMainTimer = startTimer('load:workbench.main');
require([
'vs/workbench/workbench.main',
'vs/nls!vs/workbench/workbench.main',
'vs/css!vs/workbench/workbench.main'
], function () {
workbenchMainTimer.stop();
timers.afterLoadWorkbenchMain = Date.now();
process.lazyEnv.then(function () {
require('vs/workbench/electron-browser/main')
.startup(configuration)
.done(function () {
unbind(); // since the workbench is running, unbind our developer related listeners and let the workbench handle them
}, function (error) {
onError(error, enableDeveloperTools);
});
});
if (nlsConfig.pseudo) {
require(['vs/nls'], function (nlsPlugin) {
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
});
}
// In the bundled version the nls plugin is packaged with the loader so the NLS Plugins
// loads as soon as the loader loads. To be able to have pseudo translation
const loaderTimer = startTimer('load:loader');
if (typeof Monaco_Loader_Init === 'function') {
const loader = Monaco_Loader_Init();
//eslint-disable-next-line no-global-assign
define = loader.define; require = loader.require;
onLoader();
// Perf Counters
const timers = window.MonacoEnvironment.timers = {
isInitialStartup: !!configuration.isInitialStartup,
hasAccessibilitySupport: !!configuration.accessibilitySupport,
start: configuration.perfStartTime,
appReady: configuration.perfAppReady,
windowLoad: configuration.perfWindowLoadTime,
beforeLoadWorkbenchMain: Date.now()
};
const workbenchMainClock = perf.time('loadWorkbenchMain');
require([
'vs/workbench/workbench.main',
'vs/nls!vs/workbench/workbench.main',
'vs/css!vs/workbench/workbench.main'
], function () {
workbenchMainClock.stop();
timers.afterLoadWorkbenchMain = Date.now();
process.lazyEnv.then(function () {
perf.mark('main/startup');
require('vs/workbench/electron-browser/main')
.startup(configuration)
.done(function () {
unbind(); // since the workbench is running, unbind our developer related listeners and let the workbench handle them
}, function (error) {
onError(error, enableDeveloperTools);
});
});
});
} else {
createScript(rootUrl + '/vs/loader.js', onLoader);
}
}
main();

View File

@@ -10,10 +10,8 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import { NoEditorsVisibleContext, InZenModeContext } from 'vs/workbench/electron-browser/workbench';
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
import { IListService, ListFocusContext } from 'vs/platform/list/browser/listService';
import { List } from 'vs/base/browser/ui/list/listWidget';
import errors = require('vs/base/common/errors');
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
@@ -21,6 +19,8 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import URI from 'vs/base/common/uri';
import { IEditorOptions, Position as EditorPosition } from 'vs/platform/editor/common/editor';
import { openFolderCommand, openFileInNewWindowCommand, openFileFolderInNewWindowCommand, openFolderInNewWindowCommand, openWorkspaceInNewWindowCommand } from 'vs/workbench/browser/actions/workspaceActions';
import { WorkbenchListFocusContextKey, IListService } from 'vs/platform/list/browser/listService';
import { PagedList } from 'vs/base/browser/ui/list/listPaging';
// --- List Commands
@@ -29,19 +29,18 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusDown',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.DownArrow,
mac: {
primary: KeyCode.DownArrow,
secondary: [KeyMod.WinCtrl | KeyCode.KEY_N]
},
handler: (accessor, arg2) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
const count = typeof arg2 === 'number' ? arg2 : 1;
// List
if (focused instanceof List) {
if (focused instanceof List || focused instanceof PagedList) {
const list = focused;
list.focusNext(count);
@@ -61,19 +60,18 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusUp',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.UpArrow,
mac: {
primary: KeyCode.UpArrow,
secondary: [KeyMod.WinCtrl | KeyCode.KEY_P]
},
handler: (accessor, arg2) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
const count = typeof arg2 === 'number' ? arg2 : 1;
// List
if (focused instanceof List) {
if (focused instanceof List || focused instanceof PagedList) {
const list = focused;
list.focusPrevious(count);
@@ -93,18 +91,17 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.collapse',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.LeftArrow,
mac: {
primary: KeyCode.LeftArrow,
secondary: [KeyMod.CtrlCmd | KeyCode.UpArrow]
},
handler: (accessor) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// Tree only
if (focused && !(focused instanceof List)) {
if (focused && !(focused instanceof List || focused instanceof PagedList)) {
const tree = focused;
const focus = tree.getFocus();
@@ -124,14 +121,13 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.expand',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.RightArrow,
handler: (accessor) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// Tree only
if (focused && !(focused instanceof List)) {
if (focused && !(focused instanceof List || focused instanceof PagedList)) {
const tree = focused;
const focus = tree.getFocus();
@@ -151,14 +147,13 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusPageUp',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.PageUp,
handler: (accessor) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List) {
if (focused instanceof List || focused instanceof PagedList) {
const list = focused;
list.focusPreviousPage();
@@ -178,14 +173,13 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusPageDown',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.PageDown,
handler: (accessor) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List) {
if (focused instanceof List || focused instanceof PagedList) {
const list = focused;
list.focusNextPage();
@@ -205,7 +199,7 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusFirst',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.Home,
handler: accessor => listFocusFirst(accessor)
});
@@ -213,17 +207,16 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusFirstChild',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: null,
handler: accessor => listFocusFirst(accessor, { fromFocused: true })
});
function listFocusFirst(accessor: ServicesAccessor, options?: { fromFocused: boolean }): void {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List) {
if (focused instanceof List || focused instanceof PagedList) {
const list = focused;
list.setFocus([0]);
@@ -242,7 +235,7 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusLast',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.End,
handler: accessor => listFocusLast(accessor)
});
@@ -250,17 +243,16 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.focusLastChild',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: null,
handler: accessor => listFocusLast(accessor, { fromFocused: true })
});
function listFocusLast(accessor: ServicesAccessor, options?: { fromFocused: boolean }): void {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List) {
if (focused instanceof List || focused instanceof PagedList) {
const list = focused;
list.setFocus([list.length - 1]);
@@ -279,7 +271,7 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.select',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.Enter,
secondary: [KeyMod.CtrlCmd | KeyCode.Enter],
mac: {
@@ -287,11 +279,10 @@ export function registerCommands(): void {
secondary: [KeyMod.CtrlCmd | KeyCode.Enter, KeyMod.CtrlCmd | KeyCode.DownArrow]
},
handler: (accessor) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List) {
if (focused instanceof List || focused instanceof PagedList) {
const list = focused;
list.setSelection(list.getFocus());
list.open(list.getFocus());
@@ -312,14 +303,13 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.toggleExpand',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.Space,
handler: (accessor) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// Tree only
if (focused && !(focused instanceof List)) {
if (focused && !(focused instanceof List || focused instanceof PagedList)) {
const tree = focused;
const focus = tree.getFocus();
@@ -333,14 +323,13 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.clear',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: ListFocusContext,
when: WorkbenchListFocusContextKey,
primary: KeyCode.Escape,
handler: (accessor) => {
const listService = accessor.get(IListService);
const focused = listService.getFocused();
const focused = accessor.get(IListService).lastFocusedList;
// Tree only
if (focused && !(focused instanceof List)) {
if (focused && !(focused instanceof List || focused instanceof PagedList)) {
const tree = focused;
if (tree.getSelection().length) {
@@ -373,7 +362,7 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'workbench.action.exitZenMode',
weight: CommonEditorRegistry.commandWeight(-1000),
weight: KeybindingsRegistry.WEIGHT.editorContrib(-1000),
handler(accessor: ServicesAccessor, configurationOrName: any) {
const partService = accessor.get(IPartService);
partService.toggleZenMode();
@@ -413,11 +402,11 @@ export function registerCommands(): void {
});
});
CommandsRegistry.registerCommand('_workbench.open', function (accessor: ServicesAccessor, args: [URI, number]) {
CommandsRegistry.registerCommand('_workbench.open', function (accessor: ServicesAccessor, args: [URI, IEditorOptions, EditorPosition]) {
const editorService = accessor.get(IWorkbenchEditorService);
const [resource, column] = args;
const [resource, options, column] = args;
return editorService.openEditor({ resource }, column).then(() => {
return editorService.openEditor({ resource, options }, column).then(() => {
return void 0;
});
});

View File

@@ -1,99 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import * as Path from 'vs/base/common/paths';
import URI from 'vs/base/common/uri';
import * as Labels from 'vs/base/common/labels';
import * as Platform from 'vs/base/common/platform';
import { Action } from 'vs/base/common/actions';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IEditor } from 'vs/platform/editor/common/editor';
import { IFileService } from 'vs/platform/files/common/files';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
class ConfigureLocaleAction extends Action {
public static ID = 'workbench.action.configureLocale';
public static LABEL = nls.localize('configureLocale', "Configure Language");
private static DEFAULT_CONTENT: string = [
'{',
`\t// ${nls.localize('displayLanguage', 'Defines VSCode\'s display language.')}`,
`\t// ${nls.localize('doc', 'See {0} for a list of supported languages.', 'https://go.microsoft.com/fwlink/?LinkId=761051')}`,
`\t// ${nls.localize('restart', 'Changing the value requires restarting VSCode.')}`,
`\t"locale":"${Platform.language}"`,
'}'
].join('\n');
constructor(id: string, label: string,
@IFileService private fileService: IFileService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
super(id, label);
}
public run(event?: any): TPromise<IEditor> {
const file = URI.file(Path.join(this.environmentService.appSettingsHome, 'locale.json'));
return this.fileService.resolveFile(file).then(null, (error) => {
return this.fileService.createFile(file, ConfigureLocaleAction.DEFAULT_CONTENT);
}).then((stat) => {
if (!stat) {
return undefined;
}
return this.editorService.openEditor({
resource: stat.resource,
options: {
forceOpen: true
}
});
}, (error) => {
throw new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", Labels.getPathLabel(file, this.contextService), error));
});
}
}
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLocaleAction, ConfigureLocaleAction.ID, ConfigureLocaleAction.LABEL), 'Configure Language');
let enumValues: string[] = ['de', 'en', 'en-US', 'es', 'fr', 'it', 'ja', 'ko', 'ru', 'zh-CN', 'zh-TW'];
import product from 'vs/platform/node/product';
if (product.quality !== 'stable') {
enumValues.push('hu');
}
const schemaId = 'vscode://schemas/locale';
// Keep en-US since we generated files with that content.
const schema: IJSONSchema =
{
id: schemaId,
description: 'Locale Definition file',
type: 'object',
default: {
'locale': 'en'
},
required: ['locale'],
properties: {
locale: {
type: 'string',
enum: enumValues,
description: nls.localize('JsonSchema.locale', 'The UI Language to use.')
}
}
};
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);

View File

@@ -14,7 +14,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'v
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 { CloseEditorAction, KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, OpenTipsAndTricksUrlAction, ReportIssueAction, ReportPerformanceIssueAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseWorkspaceAction, CloseCurrentWindowAction, SwitchWindow, NewWindowAction, CloseMessagesAction, NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRightAction, IncreaseViewSizeAction, DecreaseViewSizeAction, ShowStartupPerformance, ToggleSharedProcessAction, QuickSwitchWindow, QuickOpenRecentAction, inRecentFilesPickerContextKey } from 'vs/workbench/electron-browser/actions';
import { CloseEditorAction, KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, OpenTipsAndTricksUrlAction, ReportIssueAction, ReportPerformanceIssueAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseWorkspaceAction, CloseCurrentWindowAction, SwitchWindow, NewWindowAction, CloseMessagesAction, NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRightAction, IncreaseViewSizeAction, DecreaseViewSizeAction, ShowStartupPerformance, ToggleSharedProcessAction, QuickSwitchWindow, QuickOpenRecentAction, inRecentFilesPickerContextKey, ConfigureLocaleAction, ShowLogsAction, OpenLogsFolderAction, SetLogLevelAction } from 'vs/workbench/electron-browser/actions';
import { MessagesVisibleContext } from 'vs/workbench/electron-browser/workbench';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { registerCommands } from 'vs/workbench/electron-browser/commands';
@@ -22,6 +22,7 @@ import { AddRootFolderAction, GlobalRemoveRootFolderAction, OpenWorkspaceAction,
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { inQuickOpenContext, getQuickNavigateHandler } from 'vs/workbench/browser/parts/quickopen/quickopen';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
// Contribute Commands
registerCommands();
@@ -30,11 +31,15 @@ registerCommands();
const viewCategory = nls.localize('view', "View");
const helpCategory = nls.localize('help', "Help");
const fileCategory = nls.localize('file', "File");
const devCategory = nls.localize('developer', "Developer");
const workbenchActionsRegistry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(NewWindowAction, NewWindowAction.ID, NewWindowAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_N }), 'New Window');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseCurrentWindowAction, CloseCurrentWindowAction.ID, CloseCurrentWindowAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_W }), 'Close Window');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(SwitchWindow, SwitchWindow.ID, SwitchWindow.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_W } }), 'Switch Window...');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(QuickSwitchWindow, QuickSwitchWindow.ID, QuickSwitchWindow.LABEL), 'Quick Switch Window...');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowLogsAction, ShowLogsAction.ID, ShowLogsAction.LABEL), 'Developer: Show Logs...', devCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenLogsFolderAction, OpenLogsFolderAction.ID, OpenLogsFolderAction.LABEL), 'Developer: Open Log Folder', devCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(SetLogLevelAction, SetLogLevelAction.ID, SetLogLevelAction.LABEL), 'Developer: Set Log Level', devCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenRecentAction, QuickOpenRecentAction.ID, QuickOpenRecentAction.LABEL), 'File: Quick Open Recent...', fileCategory);
@@ -148,11 +153,7 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
],
'default': 'default',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'tabDescription' },
`Controls the format of the label for an editor. Changing this setting can for example make it easier to understand the location of a file:
- short: 'parent'
- medium: 'workspace/src/parent'
- long: '/home/user/workspace/src/parent'
- default: '.../parent', when another tab shares the same title, or the relative workspace path if tabs are disabled`),
"Controls the format of the label for an editor. Changing this setting can for example make it easier to understand the location of a file:\n- short: 'parent'\n- medium: 'workspace/src/parent'\n- long: '/home/user/workspace/src/parent'\n- default: '.../parent', when another tab shares the same title, or the relative workspace path if tabs are disabled"),
},
'workbench.editor.tabCloseButton': {
'type': 'string',
@@ -160,6 +161,12 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
'default': 'right',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'editorTabCloseButton' }, "Controls the position of the editor's tabs close buttons or disables them when set to 'off'.")
},
'workbench.editor.tabSizing': {
'type': 'string',
'enum': ['fit', 'shrink'],
'default': 'fit',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabSizing' }, "Controls the sizing of editor tabs. Set to 'fit' to keep tabs always large enough to show the full editor label. Set to 'shrink' to allow tabs to get smaller when the available space is not enough to show all tabs at once.")
},
'workbench.editor.showIcons': {
'type': 'boolean',
'description': nls.localize('showIcons', "Controls if opened editors should show with an icon or not. This requires an icon theme to be enabled as well."),
@@ -212,12 +219,6 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
'default': 'left',
'description': nls.localize('sideBarLocation', "Controls the location of the sidebar. It can either show on the left or right of the workbench.")
},
'workbench.panel.location': {
'type': 'string',
'enum': ['bottom', 'right'],
'default': 'bottom',
'description': nls.localize('panelLocation', "Controls the location of the panel. It can either show on the bottom or right of the workbench.")
},
'workbench.statusBar.visible': {
'type': 'boolean',
'default': true,
@@ -236,22 +237,10 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
};
if (product.quality !== 'stable') {
workbenchProperties['workbench.settings.experimentalFuzzySearchEndpoint'] = {
'type': 'string',
'description': nls.localize('experimentalFuzzySearchEndpoint', "Indicates the endpoint to use for the experimental settings search."),
'default': ''
};
workbenchProperties['workbench.settings.experimentalFuzzySearchKey'] = {
'type': 'string',
'description': nls.localize('experimentalFuzzySearchKey', "Indicates the key to use for the experimental settings search."),
'default': ''
};
workbenchProperties['workbench.settings.experimentalFuzzySearchBoost'] = {
'type': 'number',
'description': 'Indicates the amount to boost the "literal" component of the query. Temporary.',
'default': 10
workbenchProperties['workbench.settings.enableNaturalLanguageSearch'] = {
'type': 'boolean',
'description': nls.localize('enableNaturalLanguageSettingsSearch', "Controls whether to enable the natural language search mode for settings."),
'default': true
};
}
@@ -261,11 +250,7 @@ if (isMacintosh) {
'enum': ['default', 'antialiased', 'none'],
'default': 'default',
'description':
nls.localize('fontAliasing',
`Controls font aliasing method in the workbench.
- default: Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text
- antialiased: Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall
- none: Disables font smoothing. Text will show with jagged sharp edges`),
nls.localize('fontAliasing', "Controls font aliasing method in the workbench.\n- default: Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text\n- antialiased: Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall\n- none: Disables font smoothing. Text will show with jagged sharp edges"),
'enumDescriptions': [
nls.localize('workbench.fontAliasing.default', "Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text."),
nls.localize('workbench.fontAliasing.antialiased', "Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall."),
@@ -291,151 +276,121 @@ configurationRegistry.registerConfiguration({
// Configuration: Window
let properties: { [path: string]: IJSONSchema; } = {
'window.openFilesInNewWindow': {
'type': 'string',
'enum': ['on', 'off', 'default'],
'enumDescriptions': [
nls.localize('window.openFilesInNewWindow.on', "Files will open in a new window"),
nls.localize('window.openFilesInNewWindow.off', "Files will open in the window with the files' folder open or the last active window"),
nls.localize('window.openFilesInNewWindow.default', "Files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)")
],
'default': 'off',
'description':
nls.localize('openFilesInNewWindow',
`Controls if files should open in a new window.
- default: files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)
- on: files will open in a new window
- off: files will open in the window with the files' folder open or the last active window
Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).`
)
},
'window.openFoldersInNewWindow': {
'type': 'string',
'enum': ['on', 'off', 'default'],
'enumDescriptions': [
nls.localize('window.openFoldersInNewWindow.on', "Folders will open in a new window"),
nls.localize('window.openFoldersInNewWindow.off', "Folders will replace the last active window"),
nls.localize('window.openFoldersInNewWindow.default', "Folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)")
],
'default': 'default',
'description': nls.localize('openFoldersInNewWindow',
`Controls if folders should open in a new window or replace the last active window.
- default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)
- on: folders will open in a new window
- off: folders will replace the last active window
Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).`
)
},
'window.restoreWindows': {
'type': 'string',
'enum': ['all', 'folders', 'one', 'none'],
'enumDescriptions': [
nls.localize('window.reopenFolders.all', "Reopen all windows."),
nls.localize('window.reopenFolders.folders', "Reopen all folders. Empty workspaces will not be restored."),
nls.localize('window.reopenFolders.one', "Reopen the last active window."),
nls.localize('window.reopenFolders.none', "Never reopen a window. Always start with an empty one.")
],
'default': 'one',
'description': nls.localize('restoreWindows', "Controls how windows are being reopened after a restart. Select 'none' to always start with an empty workspace, 'one' to reopen the last window you worked on, 'folders' to reopen all windows that had folders opened or 'all' to reopen all windows of your last session.")
},
'window.restoreFullscreen': {
'type': 'boolean',
'default': false,
'description': nls.localize('restoreFullscreen', "Controls if a window should restore to full screen mode if it was exited in full screen mode.")
},
'window.zoomLevel': {
'type': 'number',
'default': 0,
'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.")
},
'window.title': {
'type': 'string',
'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' },
`Controls the window title based on the active editor. Variables are substituted based on the context:
\${activeEditorShort}: the file name (e.g. myFile.txt)
\${activeEditorMedium}: the path of the file relative to the workspace folder (e.g. myFolder/myFile.txt)
\${activeEditorLong}: the full path of the file (e.g. /Users/Development/myProject/myFolder/myFile.txt)
\${folderName}: name of the workspace folder the file is contained in (e.g. myFolder)
\${folderPath}: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)
\${rootName}: name of the workspace (e.g. myFolder or myWorkspace)
\${rootPath}: file path of the workspace (e.g. /Users/Development/myWorkspace)
\${appName}: e.g. VS Code
\${dirty}: a dirty indicator if the active editor is dirty
\${separator}: a conditional separator (" - ") that only shows when surrounded by variables with values`)
},
'window.newWindowDimensions': {
'type': 'string',
'enum': ['default', 'inherit', 'maximized', 'fullscreen'],
'enumDescriptions': [
nls.localize('window.newWindowDimensions.default', "Open new windows in the center of the screen."),
nls.localize('window.newWindowDimensions.inherit', "Open new windows with same dimension as last active one."),
nls.localize('window.newWindowDimensions.maximized', "Open new windows maximized."),
nls.localize('window.newWindowDimensions.fullscreen', "Open new windows in full screen mode.")
],
'default': 'default',
'description': nls.localize('newWindowDimensions', "Controls the dimensions of opening a new window when at least one window is already opened. By default, a new window will open in the center of the screen with small dimensions. When set to 'inherit', the window will get the same dimensions as the last window that was active. When set to 'maximized', the window will open maximized and fullscreen if configured to 'fullscreen'. Note that this setting does not have an impact on the first window that is opened. The first window will always restore the size and location as you left it before closing.")
},
'window.closeWhenEmpty': {
'type': 'boolean',
'default': false,
'description': nls.localize('closeWhenEmpty', "Controls if closing the last editor should also close the window. This setting only applies for windows that do not show folders.")
}
};
if (isWindows || isLinux) {
properties['window.menuBarVisibility'] = {
'type': 'string',
'enum': ['default', 'visible', 'toggle', 'hidden'],
'enumDescriptions': [
nls.localize('window.menuBarVisibility.default', "Menu is only hidden in full screen mode."),
nls.localize('window.menuBarVisibility.visible', "Menu is always visible even in full screen mode."),
nls.localize('window.menuBarVisibility.toggle', "Menu is hidden but can be displayed via Alt key."),
nls.localize('window.menuBarVisibility.hidden', "Menu is always hidden.")
],
'default': 'default',
'description': nls.localize('menuBarVisibility', "Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and a single press of the Alt key will show it. By default, the menu bar will be visible, unless the window is full screen.")
};
properties['window.enableMenuBarMnemonics'] = {
'type': 'boolean',
'default': true,
'description': nls.localize('enableMenuBarMnemonics', "If enabled, the main menus can be opened via Alt-key shortcuts. Disabling mnemonics allows to bind these Alt-key shortcuts to editor commands instead.")
};
}
if (isWindows) {
properties['window.autoDetectHighContrast'] = {
'type': 'boolean',
'default': true,
'description': nls.localize('autoDetectHighContrast', "If enabled, will automatically change to high contrast theme if Windows is using a high contrast theme, and to dark theme when switching away from a Windows high contrast theme."),
};
}
if (isMacintosh) {
properties['window.titleBarStyle'] = {
'type': 'string',
'enum': ['native', 'custom'],
'default': 'custom',
'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. Changes require a full restart to apply.")
};
// Minimum: macOS Sierra (10.12.x = darwin 16.x)
if (parseFloat(os.release()) >= 16) {
properties['window.nativeTabs'] = {
'type': 'boolean',
'default': false,
'description': nls.localize('window.nativeTabs', "Enables macOS Sierra window tabs. Note that changes require a full restart to apply and that native tabs will disable a custom title bar style if configured.")
};
}
}
configurationRegistry.registerConfiguration({
'id': 'window',
'order': 8,
'title': nls.localize('windowConfigurationTitle', "Window"),
'type': 'object',
'properties': properties
'properties': {
'window.openFilesInNewWindow': {
'type': 'string',
'enum': ['on', 'off', 'default'],
'enumDescriptions': [
nls.localize('window.openFilesInNewWindow.on', "Files will open in a new window"),
nls.localize('window.openFilesInNewWindow.off', "Files will open in the window with the files' folder open or the last active window"),
nls.localize('window.openFilesInNewWindow.default', "Files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)")
],
'default': 'off',
'description':
nls.localize('openFilesInNewWindow', "Controls if files should open in a new window.\n- default: files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)\n- on: files will open in a new window\n- off: files will open in the window with the files' folder open or the last active window\nNote that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).")
},
'window.openFoldersInNewWindow': {
'type': 'string',
'enum': ['on', 'off', 'default'],
'enumDescriptions': [
nls.localize('window.openFoldersInNewWindow.on', "Folders will open in a new window"),
nls.localize('window.openFoldersInNewWindow.off', "Folders will replace the last active window"),
nls.localize('window.openFoldersInNewWindow.default', "Folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)")
],
'default': 'default',
'description': nls.localize('openFoldersInNewWindow', "Controls if folders should open in a new window or replace the last active window.\n- default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)\n- on: folders will open in a new window\n- off: folders will replace the last active window\nNote that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option)."
)
},
'window.restoreWindows': {
'type': 'string',
'enum': ['all', 'folders', 'one', 'none'],
'enumDescriptions': [
nls.localize('window.reopenFolders.all', "Reopen all windows."),
nls.localize('window.reopenFolders.folders', "Reopen all folders. Empty workspaces will not be restored."),
nls.localize('window.reopenFolders.one', "Reopen the last active window."),
nls.localize('window.reopenFolders.none', "Never reopen a window. Always start with an empty one.")
],
'default': 'one',
'description': nls.localize('restoreWindows', "Controls how windows are being reopened after a restart. Select 'none' to always start with an empty workspace, 'one' to reopen the last window you worked on, 'folders' to reopen all windows that had folders opened or 'all' to reopen all windows of your last session.")
},
'window.restoreFullscreen': {
'type': 'boolean',
'default': false,
'description': nls.localize('restoreFullscreen', "Controls if a window should restore to full screen mode if it was exited in full screen mode.")
},
'window.zoomLevel': {
'type': 'number',
'default': 0,
'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.")
},
'window.title': {
'type': 'string',
'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' },
"Controls the window title based on the active editor. Variables are substituted based on the context:\n\${activeEditorShort}: the file name (e.g. myFile.txt)\n\${activeEditorMedium}: the path of the file relative to the workspace folder (e.g. myFolder/myFile.txt)\n\${activeEditorLong}: the full path of the file (e.g. /Users/Development/myProject/myFolder/myFile.txt)\n\${folderName}: name of the workspace folder the file is contained in (e.g. myFolder)\n\${folderPath}: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)\n\${rootName}: name of the workspace (e.g. myFolder or myWorkspace)\n\${rootPath}: file path of the workspace (e.g. /Users/Development/myWorkspace)\n\${appName}: e.g. VS Code\n\${dirty}: a dirty indicator if the active editor is dirty\n\${separator}: a conditional separator (\" - \") that only shows when surrounded by variables with values")
},
'window.newWindowDimensions': {
'type': 'string',
'enum': ['default', 'inherit', 'maximized', 'fullscreen'],
'enumDescriptions': [
nls.localize('window.newWindowDimensions.default', "Open new windows in the center of the screen."),
nls.localize('window.newWindowDimensions.inherit', "Open new windows with same dimension as last active one."),
nls.localize('window.newWindowDimensions.maximized', "Open new windows maximized."),
nls.localize('window.newWindowDimensions.fullscreen', "Open new windows in full screen mode.")
],
'default': 'default',
'description': nls.localize('newWindowDimensions', "Controls the dimensions of opening a new window when at least one window is already opened. By default, a new window will open in the center of the screen with small dimensions. When set to 'inherit', the window will get the same dimensions as the last window that was active. When set to 'maximized', the window will open maximized and fullscreen if configured to 'fullscreen'. Note that this setting does not have an impact on the first window that is opened. The first window will always restore the size and location as you left it before closing.")
},
'window.closeWhenEmpty': {
'type': 'boolean',
'default': false,
'description': nls.localize('closeWhenEmpty', "Controls if closing the last editor should also close the window. This setting only applies for windows that do not show folders.")
},
'window.menuBarVisibility': {
'type': 'string',
'enum': ['default', 'visible', 'toggle', 'hidden'],
'enumDescriptions': [
nls.localize('window.menuBarVisibility.default', "Menu is only hidden in full screen mode."),
nls.localize('window.menuBarVisibility.visible', "Menu is always visible even in full screen mode."),
nls.localize('window.menuBarVisibility.toggle', "Menu is hidden but can be displayed via Alt key."),
nls.localize('window.menuBarVisibility.hidden', "Menu is always hidden.")
],
'default': 'default',
'description': nls.localize('menuBarVisibility', "Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and a single press of the Alt key will show it. By default, the menu bar will be visible, unless the window is full screen."),
'included': isWindows || isLinux
},
'window.enableMenuBarMnemonics': {
'type': 'boolean',
'default': true,
'description': nls.localize('enableMenuBarMnemonics', "If enabled, the main menus can be opened via Alt-key shortcuts. Disabling mnemonics allows to bind these Alt-key shortcuts to editor commands instead."),
'included': isWindows || isLinux
},
'window.autoDetectHighContrast': {
'type': 'boolean',
'default': true,
'description': nls.localize('autoDetectHighContrast', "If enabled, will automatically change to high contrast theme if Windows is using a high contrast theme, and to dark theme when switching away from a Windows high contrast theme."),
'included': !isWindows
},
'window.titleBarStyle': {
'type': 'string',
'enum': ['native', 'custom'],
'default': 'custom',
'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. Changes require a full restart to apply."),
'included': isMacintosh
},
'window.nativeTabs': {
'type': 'boolean',
'default': false,
'description': nls.localize('window.nativeTabs', "Enables macOS Sierra window tabs. Note that changes require a full restart to apply and that native tabs will disable a custom title bar style if configured."),
'included': isMacintosh && parseFloat(os.release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
}
}
});
// Configuration: Zen Mode
@@ -472,3 +427,37 @@ configurationRegistry.registerConfiguration({
}
}
});
// Register action to configure locale and related settings
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLocaleAction, ConfigureLocaleAction.ID, ConfigureLocaleAction.LABEL), 'Configure Language');
let enumValues: string[] = ['de', 'en', 'en-US', 'es', 'fr', 'it', 'ja', 'ko', 'ru', 'zh-CN', 'zh-TW'];
if (product.quality !== 'stable') {
enumValues.push('hu');
}
const schemaId = 'vscode://schemas/locale';
// Keep en-US since we generated files with that content.
const schema: IJSONSchema =
{
id: schemaId,
allowComments: true,
description: 'Locale Definition file',
type: 'object',
default: {
'locale': 'en'
},
required: ['locale'],
properties: {
locale: {
type: 'string',
enum: enumValues,
description: nls.localize('JsonSchema.locale', 'The UI Language to use.')
}
}
};
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
jsonRegistry.registerSchema(schemaId, schema);

View File

@@ -39,10 +39,10 @@ import { URLChannelClient } from 'vs/platform/url/common/urlIpc';
import { IURLService } from 'vs/platform/url/common/url';
import { WorkspacesChannelClient } from 'vs/platform/workspaces/common/workspacesIpc';
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import { ICredentialsService } from 'vs/platform/credentials/common/credentials';
import { CredentialsChannelClient } from 'vs/platform/credentials/node/credentialsIpc';
import { createLogService } from 'vs/platform/log/node/spdlogService';
import fs = require('fs');
import { ConsoleLogService, MultiplexLogService } from 'vs/platform/log/common/log';
gracefulFs.gracefulify(fs); // enable gracefulFs
const currentWindowId = remote.getCurrentWindow().id;
@@ -74,10 +74,16 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
const mainServices = createMainProcessServices(mainProcessClient);
const environmentService = new EnvironmentService(configuration, configuration.execPath);
const spdlogService = createLogService(`renderer${currentWindowId}`, environmentService);
const consoleLogService = new ConsoleLogService(environmentService);
const logService = new MultiplexLogService([consoleLogService, spdlogService]);
logService.trace('openWorkbench configuration', JSON.stringify(configuration));
// Since the configuration service is one of the core services that is used in so many places, we initialize it
// right before startup of the workbench shell to have its data ready for consumers
return createAndInitializeWorkspaceService(configuration, environmentService, <IWorkspacesService>mainServices.get(IWorkspacesService)).then(workspaceService => {
return createAndInitializeWorkspaceService(configuration, environmentService).then(workspaceService => {
const timerService = new TimerService((<any>window).MonacoEnvironment.timers as IInitData, workspaceService.getWorkbenchState() === WorkbenchState.EMPTY);
const storageService = createStorageService(workspaceService, environmentService);
@@ -92,6 +98,7 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
contextService: workspaceService,
configurationService: workspaceService,
environmentService,
logService,
timerService,
storageService
}, mainServices, configuration);
@@ -109,9 +116,9 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
});
}
function createAndInitializeWorkspaceService(configuration: IWindowConfiguration, environmentService: EnvironmentService, workspacesService: IWorkspacesService): TPromise<WorkspaceService> {
function createAndInitializeWorkspaceService(configuration: IWindowConfiguration, environmentService: EnvironmentService): TPromise<WorkspaceService> {
return validateSingleFolderPath(configuration).then(() => {
const workspaceService = new WorkspaceService(environmentService, workspacesService);
const workspaceService = new WorkspaceService(environmentService);
return workspaceService.initialize(configuration.workspace || configuration.folderPath || configuration).then(() => workspaceService, error => workspaceService);
});
@@ -202,9 +209,6 @@ function createMainProcessServices(mainProcessClient: ElectronIPCClient): Servic
const workspacesChannel = mainProcessClient.getChannel('workspaces');
serviceCollection.set(IWorkspacesService, new WorkspacesChannelClient(workspacesChannel));
const credentialsChannel = mainProcessClient.getChannel('credentials');
serviceCollection.set(ICredentialsService, new CredentialsChannelClient(credentialsChannel));
return serviceCollection;
}

View File

@@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { basename } from 'path';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
declare type OnNodeCachedDataArgs = [{ errorCode: string, path: string, detail?: string }, { path: string, length: number }];
declare const MonacoEnvironment: { onNodeCachedData: OnNodeCachedDataArgs[] };
export class NodeCachedDataManager {
private readonly _telemetryService: ITelemetryService;
constructor(
@ITelemetryService telemetryService: ITelemetryService,
) {
this._telemetryService = telemetryService;
this._handleCachedDataInfo();
}
private _handleCachedDataInfo(): void {
let didRejectCachedData = false;
let didProduceCachedData = false;
for (const [err, data] of MonacoEnvironment.onNodeCachedData) {
// build summary
didRejectCachedData = didRejectCachedData || Boolean(err);
didProduceCachedData = didProduceCachedData || Boolean(data);
// log each failure separately
if (err) {
/* __GDPR__
"cachedDataError" : {
"errorCode" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
"path": { "classification": "CustomerContent", "purpose": "PerformanceAndHealth" }
}
*/
this._telemetryService.publicLog('cachedDataError', {
errorCode: err.errorCode,
path: basename(err.path)
});
}
}
// log summary
/* __GDPR__
"cachedDataInfo" : {
"didRequestCachedData" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
"didRejectCachedData": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
"didProduceCachedData": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
}
*/
this._telemetryService.publicLog('cachedDataInfo', {
didRequestCachedData: Boolean(global.require.getConfig().nodeCachedDataDir),
didRejectCachedData,
didProduceCachedData
});
global.require.config({ onNodeCachedData: undefined });
delete MonacoEnvironment.onNodeCachedData;
}
}

View File

@@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import URI from 'vs/base/common/uri';
import objects = require('vs/base/common/objects');
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import Event, { Emitter } from 'vs/base/common/event';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { ParsedExpression, IExpression, parse } from 'vs/base/common/glob';
import { relative } from 'path';
import { normalize } from 'vs/base/common/paths';
export class ResourceGlobMatcher {
private static readonly NO_ROOT: string = null;
private _onExpressionChange: Emitter<void>;
private toUnbind: IDisposable[];
private mapRootToParsedExpression: Map<string, ParsedExpression>;
private mapRootToExpressionConfig: Map<string, IExpression>;
constructor(
private globFn: (root?: URI) => IExpression,
private shouldUpdate: (event: IConfigurationChangeEvent) => boolean,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IConfigurationService private configurationService: IConfigurationService
) {
this.toUnbind = [];
this.mapRootToParsedExpression = new Map<string, ParsedExpression>();
this.mapRootToExpressionConfig = new Map<string, IExpression>();
this._onExpressionChange = new Emitter<void>();
this.toUnbind.push(this._onExpressionChange);
this.updateExcludes(false);
this.registerListeners();
}
public get onExpressionChange(): Event<void> {
return this._onExpressionChange.event;
}
private registerListeners(): void {
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => {
if (this.shouldUpdate(e)) {
this.updateExcludes(true);
}
}));
this.toUnbind.push(this.contextService.onDidChangeWorkspaceFolders(() => this.updateExcludes(true)));
}
private updateExcludes(fromEvent: boolean): void {
let changed = false;
// Add excludes per workspaces that got added
this.contextService.getWorkspace().folders.forEach(folder => {
const rootExcludes = this.globFn(folder.uri);
if (!this.mapRootToExpressionConfig.has(folder.uri.toString()) || !objects.equals(this.mapRootToExpressionConfig.get(folder.uri.toString()), rootExcludes)) {
changed = true;
this.mapRootToParsedExpression.set(folder.uri.toString(), parse(rootExcludes));
this.mapRootToExpressionConfig.set(folder.uri.toString(), objects.deepClone(rootExcludes));
}
});
// Remove excludes per workspace no longer present
this.mapRootToExpressionConfig.forEach((value, root) => {
if (root === ResourceGlobMatcher.NO_ROOT) {
return; // always keep this one
}
if (!this.contextService.getWorkspaceFolder(URI.parse(root))) {
this.mapRootToParsedExpression.delete(root);
this.mapRootToExpressionConfig.delete(root);
changed = true;
}
});
// Always set for resources outside root as well
const globalExcludes = this.globFn();
if (!this.mapRootToExpressionConfig.has(ResourceGlobMatcher.NO_ROOT) || !objects.equals(this.mapRootToExpressionConfig.get(ResourceGlobMatcher.NO_ROOT), globalExcludes)) {
changed = true;
this.mapRootToParsedExpression.set(ResourceGlobMatcher.NO_ROOT, parse(globalExcludes));
this.mapRootToExpressionConfig.set(ResourceGlobMatcher.NO_ROOT, objects.deepClone(globalExcludes));
}
if (fromEvent && changed) {
this._onExpressionChange.fire();
}
}
public matches(resource: URI): boolean {
const folder = this.contextService.getWorkspaceFolder(resource);
let expressionForRoot: ParsedExpression;
if (folder && this.mapRootToParsedExpression.has(folder.uri.toString())) {
expressionForRoot = this.mapRootToParsedExpression.get(folder.uri.toString());
} else {
expressionForRoot = this.mapRootToParsedExpression.get(ResourceGlobMatcher.NO_ROOT);
}
// If the resource if from a workspace, convert its absolute path to a relative
// path so that glob patterns have a higher probability to match. For example
// a glob pattern of "src/**" will not match on an absolute path "/folder/src/file.txt"
// but can match on "src/file.txt"
let resourcePathToMatch: string;
if (folder) {
resourcePathToMatch = normalize(relative(folder.uri.fsPath, resource.fsPath));
} else {
resourcePathToMatch = resource.fsPath;
}
return !!expressionForRoot(resourcePathToMatch);
}
public dispose(): void {
this.toUnbind = dispose(this.toUnbind);
}
}

View File

@@ -8,7 +8,6 @@
import 'vs/css!./media/shell';
import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import * as platform from 'vs/base/common/platform';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import dom = require('vs/base/browser/dom');
@@ -22,16 +21,13 @@ import pkg from 'vs/platform/node/package';
import { ContextViewService } from 'vs/platform/contextview/browser/contextViewService';
import { Workbench, IWorkbenchStartedInfo } from 'vs/workbench/electron-browser/workbench';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { NullTelemetryService, configurationTelemetry, lifecycleTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { NullTelemetryService, configurationTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { IExperimentService, ExperimentService } from 'vs/platform/telemetry/common/experiments';
import { ITelemetryAppenderChannel, TelemetryAppenderClient } from 'vs/platform/telemetry/common/telemetryIpc';
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
import { IdleMonitor, UserStatus } from 'vs/platform/telemetry/browser/idleMonitor';
import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry';
import { ElectronWindow } from 'vs/workbench/electron-browser/window';
import { resolveWorkbenchCommonProperties, getOrCreateMachineId } from 'vs/platform/telemetry/node/workbenchCommonProperties';
import { machineIdIpcChannel } from 'vs/platform/telemetry/node/commonProperties';
import { WorkspaceStats } from 'vs/workbench/services/telemetry/node/workspaceStats';
import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/node/workbenchCommonProperties';
import { IWindowsService, IWindowService, IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { WindowService } from 'vs/platform/windows/electron-browser/windowService';
import { MessageService } from 'vs/workbench/services/message/electron-browser/messageService';
@@ -44,7 +40,7 @@ import { MarkerService } from 'vs/platform/markers/common/markerService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServiceImpl';
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IntegrityServiceImpl } from 'vs/platform/integrity/node/integrityServiceImpl';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
import { EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl';
@@ -68,16 +64,14 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { WorkbenchModeServiceImpl } from 'vs/workbench/services/mode/common/workbenchModeService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { ICrashReporterService, NullCrashReporterService } from 'vs/workbench/services/crashReporter/common/crashReporterService';
import { CrashReporterService } from 'vs/workbench/services/crashReporter/electron-browser/crashReporterService';
import { NodeCachedDataManager } from 'vs/workbench/electron-browser/nodeCachedDataManager';
import { ICrashReporterService, NullCrashReporterService, CrashReporterService } from 'vs/workbench/services/crashReporter/electron-browser/crashReporterService';
import { getDelayedChannel } from 'vs/base/parts/ipc/common/ipc';
import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net';
import { IExtensionManagementChannel, ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/common/extensionManagementIpc';
import { IExtensionManagementService, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionEnablementService';
import { ITimerService } from 'vs/workbench/services/timer/common/timerService';
import { remote, ipcRenderer as ipc } from 'electron';
import { remote } from 'electron';
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
import { restoreFontInfo, readFontInfo, saveFontInfo } from 'vs/editor/browser/config/configuration';
import * as browser from 'vs/base/browser/browser';
@@ -93,6 +87,7 @@ import { ITextMateService } from 'vs/workbench/services/textMate/electron-browse
import { IBroadcastService, BroadcastService } from 'vs/platform/broadcast/electron-browser/broadcastService';
import { HashService } from 'vs/workbench/services/hash/node/hashService';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
import { ILogService } from 'vs/platform/log/common/log';
/**
* Services that we require for the Shell
@@ -101,6 +96,7 @@ export interface ICoreServices {
contextService: IWorkspaceContextService;
configurationService: IConfigurationService;
environmentService: IEnvironmentService;
logService: ILogService;
timerService: ITimerService;
storageService: IStorageService;
}
@@ -115,6 +111,7 @@ export class WorkbenchShell {
private storageService: IStorageService;
private messageService: MessageService;
private environmentService: IEnvironmentService;
private logService: ILogService;
private contextViewService: ContextViewService;
private configurationService: IConfigurationService;
private contextService: IWorkspaceContextService;
@@ -145,6 +142,7 @@ export class WorkbenchShell {
this.contextService = coreServices.contextService;
this.configurationService = coreServices.configurationService;
this.environmentService = coreServices.environmentService;
this.logService = coreServices.logService;
this.timerService = coreServices.timerService;
this.storageService = coreServices.storageService;
@@ -166,40 +164,62 @@ export class WorkbenchShell {
const [instantiationService, serviceCollection] = this.initServiceCollection(parent.getHTMLElement());
// Workbench
this.workbench = instantiationService.createInstance(Workbench, parent.getHTMLElement(), workbenchContainer.getHTMLElement(), this.configuration, serviceCollection);
this.workbench.startup({
onWorkbenchStarted: (info: IWorkbenchStartedInfo) => {
this.workbench = instantiationService.createInstance(Workbench, parent.getHTMLElement(), workbenchContainer.getHTMLElement(), this.configuration, serviceCollection, this.lifecycleService);
try {
this.workbench.startup().done(startupInfos => this.onWorkbenchStarted(startupInfos, instantiationService));
} catch (error) {
// run workbench started logic
this.onWorkbenchStarted(info);
// Log it
this.logService.error(toErrorMessage(error, true));
// start cached data manager
instantiationService.createInstance(NodeCachedDataManager);
// Set lifecycle phase to `Runnning` so that other contributions
// can now do something
this.lifecycleService.phase = LifecyclePhase.Running;
}
});
// Rethrow
throw error;
}
// Window
this.workbench.getInstantiationService().createInstance(ElectronWindow, this.container);
// Handle case where workbench is not starting up properly
const timeoutHandle = setTimeout(() => {
console.warn('Workbench did not finish loading in 10 seconds, that might be a problem that should be reported.');
this.logService.warn('Workbench did not finish loading in 10 seconds, that might be a problem that should be reported.');
}, 10000);
this.workbench.joinCreation().then(() => {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
clearTimeout(timeoutHandle);
});
return workbenchContainer;
}
private onWorkbenchStarted(info: IWorkbenchStartedInfo): void {
private onWorkbenchStarted(info: IWorkbenchStartedInfo, instantiationService: IInstantiationService): void {
// Telemetry: workspace info
// Startup Telemetry
this.logStartupTelemetry(info);
// Root Warning
if ((platform.isLinux || platform.isMacintosh) && process.getuid() === 0) {
// {{SQL CARBON EDIT}}
this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run SQL Operations Studio as 'root'."));
}
// Set lifecycle phase to `Runnning` so that other contributions can now do something
this.lifecycleService.phase = LifecyclePhase.Running;
// Set lifecycle phase to `Runnning For A Bit` after a short delay
let timeoutHandle = setTimeout(() => {
timeoutHandle = void 0;
this.lifecycleService.phase = LifecyclePhase.Eventually;
}, 3000);
this.toUnbind.push({
dispose: () => {
if (timeoutHandle) {
clearTimeout(timeoutHandle);
}
}
});
}
private logStartupTelemetry(info: IWorkbenchStartedInfo): void {
const { filesToOpen, filesToCreate, filesToDiff } = this.configuration;
/* __GDPR__
"workspaceLoad" : {
@@ -244,7 +264,7 @@ export class WorkbenchShell {
this.timerService.workbenchStarted = Date.now();
this.timerService.restoreEditorsDuration = info.restoreEditorsDuration;
this.timerService.restoreViewletDuration = info.restoreViewletDuration;
this.extensionService.onReady().done(() => {
this.extensionService.whenInstalledExtensionsRegistered().done(() => {
/* __GDPR__
"startupTime" : {
"${include}": [
@@ -254,16 +274,6 @@ export class WorkbenchShell {
*/
this.telemetryService.publicLog('startupTime', this.timerService.startupMetrics);
});
// Telemetry: workspace tags
const workspaceStats: WorkspaceStats = <WorkspaceStats>this.workbench.getInstantiationService().createInstance(WorkspaceStats);
workspaceStats.reportWorkspaceTags(this.configuration);
workspaceStats.reportCloudStats();
if ((platform.isLinux || platform.isMacintosh) && process.getuid() === 0) {
// {{SQL CARBON EDIT}}
this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run sqlops as 'root'."));
}
}
private initServiceCollection(container: HTMLElement): [IInstantiationService, ServiceCollection] {
@@ -273,6 +283,9 @@ export class WorkbenchShell {
serviceCollection.set(IWorkspaceContextService, this.contextService);
serviceCollection.set(IConfigurationService, this.configurationService);
serviceCollection.set(IEnvironmentService, this.environmentService);
serviceCollection.set(ILogService, this.logService);
disposables.push(this.logService);
serviceCollection.set(ITimerService, this.timerService);
serviceCollection.set(IStorageService, this.storageService);
this.mainProcessServices.forEach((serviceIdentifier, serviceInstance) => {
@@ -284,7 +297,7 @@ export class WorkbenchShell {
this.broadcastService = new BroadcastService(currentWindow.id);
serviceCollection.set(IBroadcastService, this.broadcastService);
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, currentWindow.id));
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, currentWindow.id, this.configuration));
const sharedProcess = (<IWindowsService>serviceCollection.get(IWindowsService)).whenSharedProcessReady()
.then(() => connectNet(this.environmentService.sharedIPCHandle, `window:${currentWindow.id}`));
@@ -294,7 +307,7 @@ export class WorkbenchShell {
// Warm up font cache information before building up too many dom elements
restoreFontInfo(this.storageService);
readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getConfiguration('editor'), browser.getZoomLevel()));
readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getValue('editor'), browser.getZoomLevel()));
// Hash
serviceCollection.set(IHashService, new SyncDescriptor(HashService));
@@ -304,7 +317,6 @@ export class WorkbenchShell {
serviceCollection.set(IExperimentService, this.experimentService);
// Telemetry
this.sendMachineIdToMain(this.storageService);
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
const channel = getDelayedChannel<ITelemetryAppenderChannel>(sharedProcess.then(c => c.getChannel('telemetryAppender')));
const commit = product.commit;
@@ -312,7 +324,7 @@ export class WorkbenchShell {
const config: ITelemetryServiceConfig = {
appender: new TelemetryAppenderClient(channel),
commonProperties: resolveWorkbenchCommonProperties(this.storageService, commit, version, this.environmentService.installSource),
commonProperties: resolveWorkbenchCommonProperties(this.storageService, commit, version, this.configuration.machineId, this.environmentService.installSourcePath),
piiPaths: [this.environmentService.appRoot, this.environmentService.extensionsPath]
};
@@ -320,21 +332,8 @@ export class WorkbenchShell {
this.telemetryService = telemetryService;
const errorTelemetry = new ErrorTelemetry(telemetryService);
const idleMonitor = new IdleMonitor(2 * 60 * 1000); // 2 minutes
const listener = idleMonitor.onStatusChange(status =>
/* __GDPR__
"UserIdleStart" : {}
*/
/* __GDPR__
"UserIdleStop" : {}
*/
this.telemetryService.publicLog(status === UserStatus.Active
? TelemetryService.IDLE_STOP_EVENT_NAME
: TelemetryService.IDLE_START_EVENT_NAME
));
disposables.push(telemetryService, errorTelemetry, listener, idleMonitor);
disposables.push(telemetryService, errorTelemetry);
} else {
this.telemetryService = NullTelemetryService;
}
@@ -356,7 +355,6 @@ export class WorkbenchShell {
this.toUnbind.push(lifecycleService.onShutdown(reason => dispose(disposables)));
this.toUnbind.push(lifecycleService.onShutdown(reason => saveFontInfo(this.storageService)));
serviceCollection.set(ILifecycleService, lifecycleService);
disposables.push(lifecycleTelemetry(this.telemetryService, lifecycleService));
this.lifecycleService = lifecycleService;
const extensionManagementChannel = getDelayedChannel<IExtensionManagementChannel>(sharedProcess.then(c => c.getChannel('extensions')));
@@ -370,7 +368,7 @@ export class WorkbenchShell {
serviceCollection.set(IExtensionService, this.extensionService);
this.timerService.beforeExtensionLoad = Date.now();
this.extensionService.onReady().done(() => {
this.extensionService.whenInstalledExtensionsRegistered().done(() => {
this.timerService.afterExtensionLoad = Date.now();
});
@@ -407,12 +405,6 @@ export class WorkbenchShell {
return [instantiationService, serviceCollection];
}
private sendMachineIdToMain(storageService: IStorageService) {
getOrCreateMachineId(storageService).then(machineId => {
ipc.send(machineIdIpcChannel, machineId);
}).then(null, errors.onUnexpectedError);
}
public open(): void {
// Listen on unexpected errors
@@ -456,8 +448,8 @@ export class WorkbenchShell {
this.previousErrorTime = now;
this.previousErrorValue = errorMsg;
// Log to console
console.error(errorMsg);
// Log it
this.logService.error(errorMsg);
// Show to user if friendly message provided
if (error && error.friendlyMessage && this.messageService) {
@@ -475,10 +467,6 @@ export class WorkbenchShell {
this.workbench.layout();
}
public joinCreation(): TPromise<boolean> {
return this.workbench.joinCreation();
}
public dispose(): void {
// Workbench

View File

@@ -17,7 +17,6 @@ import DOM = require('vs/base/browser/dom');
import Severity from 'vs/base/common/severity';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IAction, Action } from 'vs/base/common/actions';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { AutoSaveConfiguration, IFileService } from 'vs/platform/files/common/files';
import { toResource } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService, IResourceInputType } from 'vs/workbench/services/editor/common/editorService';
@@ -27,7 +26,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import { IWindowsService, IWindowService, IWindowSettings, IPath, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest } from 'vs/platform/windows/common/windows';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
import { IWorkbenchThemeService, VS_HC_THEME, VS_DARK_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
@@ -39,14 +37,15 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/keybindingService';
import { Themable } from 'vs/workbench/common/theme';
import { ipcRenderer as ipc, webFrame } from 'electron';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction } from 'vs/platform/actions/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { fillInActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ConfigurationTarget, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
const TextInputActions: IAction[] = [
new Action('undo', nls.localize('undo', "Undo"), null, true, () => document.execCommand('undo') && TPromise.as(true)),
@@ -61,7 +60,7 @@ const TextInputActions: IAction[] = [
export class ElectronWindow extends Themable {
private static AUTO_SAVE_SETTING = 'files.autoSave';
private static readonly AUTO_SAVE_SETTING = 'files.autoSave';
private touchBarUpdater: RunOnceScheduler;
private touchBarMenu: IMenu;
@@ -70,11 +69,13 @@ export class ElectronWindow extends Themable {
private previousConfiguredZoomLevel: number;
private addFoldersScheduler: RunOnceScheduler;
private pendingFoldersToAdd: IAddFoldersRequest[];
constructor(
shellContainer: HTMLElement,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IPartService private partService: IPartService,
@IWindowsService private windowsService: IWindowsService,
@IWindowService private windowService: IWindowService,
@IWorkspaceConfigurationService private configurationService: IWorkspaceConfigurationService,
@@ -86,13 +87,11 @@ export class ElectronWindow extends Themable {
@IViewletService private viewletService: IViewletService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IKeybindingService private keybindingService: IKeybindingService,
@IEnvironmentService private environmentService: IEnvironmentService,
@ITelemetryService private telemetryService: ITelemetryService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
@IFileService private fileService: IFileService,
@IMenuService private menuService: IMenuService,
@IContextKeyService private contextKeyService: IContextKeyService
@ILifecycleService private lifecycleService: ILifecycleService
) {
super(themeService);
@@ -101,6 +100,10 @@ export class ElectronWindow extends Themable {
this.touchBarUpdater = new RunOnceScheduler(() => this.doSetupTouchbar(), 300);
this.toUnbind.push(this.touchBarUpdater);
this.pendingFoldersToAdd = [];
this.addFoldersScheduler = new RunOnceScheduler(() => this.doAddFolders(), 100);
this.toUnbind.push(this.addFoldersScheduler);
this.registerListeners();
this.create();
}
@@ -126,7 +129,7 @@ export class ElectronWindow extends Themable {
});
// Support runAction event
ipc.on('vscode:runAction', (event, request: IRunActionInWindowRequest) => {
ipc.on('vscode:runAction', (_event: any, request: IRunActionInWindowRequest) => {
const args: any[] = [];
// If we run an action from the touchbar, we fill in the currently active resource
@@ -157,7 +160,7 @@ export class ElectronWindow extends Themable {
});
// Support resolve keybindings event
ipc.on('vscode:resolveKeybindings', (event, rawActionIds: string) => {
ipc.on('vscode:resolveKeybindings', (_event: any, rawActionIds: string) => {
let actionIds: string[] = [];
try {
actionIds = JSON.parse(rawActionIds);
@@ -173,7 +176,7 @@ export class ElectronWindow extends Themable {
}, () => errors.onUnexpectedError);
});
ipc.on('vscode:reportError', (event, error) => {
ipc.on('vscode:reportError', (_event: any, error: string) => {
if (error) {
const errorParsed = JSON.parse(error);
errorParsed.mainProcess = true;
@@ -182,65 +185,70 @@ export class ElectronWindow extends Themable {
});
// Support openFiles event for existing and new files
ipc.on('vscode:openFiles', (event, request: IOpenFileRequest) => this.onOpenFiles(request));
ipc.on('vscode:openFiles', (_event: any, request: IOpenFileRequest) => this.onOpenFiles(request));
// Support addFolders event if we have a workspace opened
ipc.on('vscode:addFolders', (event, request: IAddFoldersRequest) => this.onAddFolders(request));
ipc.on('vscode:addFolders', (_event: any, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
// Message support
ipc.on('vscode:showInfoMessage', (event, message: string) => {
ipc.on('vscode:showInfoMessage', (_event: any, message: string) => {
this.messageService.show(Severity.Info, message);
});
// Support toggling auto save
ipc.on('vscode.toggleAutoSave', event => {
ipc.on('vscode.toggleAutoSave', () => {
this.toggleAutoSave();
});
// Fullscreen Events
ipc.on('vscode:enterFullScreen', event => {
this.partService.joinCreation().then(() => {
ipc.on('vscode:enterFullScreen', () => {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
browser.setFullscreen(true);
});
});
ipc.on('vscode:leaveFullScreen', event => {
this.partService.joinCreation().then(() => {
ipc.on('vscode:leaveFullScreen', () => {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
browser.setFullscreen(false);
});
});
// High Contrast Events
ipc.on('vscode:enterHighContrast', event => {
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
ipc.on('vscode:enterHighContrast', () => {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
if (windowConfig && windowConfig.autoDetectHighContrast) {
this.partService.joinCreation().then(() => {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
this.themeService.setColorTheme(VS_HC_THEME, null);
});
}
});
ipc.on('vscode:leaveHighContrast', event => {
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
ipc.on('vscode:leaveHighContrast', () => {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
if (windowConfig && windowConfig.autoDetectHighContrast) {
this.partService.joinCreation().then(() => {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
this.themeService.setColorTheme(VS_DARK_THEME, null);
});
}
});
// keyboard layout changed event
ipc.on('vscode:keyboardLayoutChanged', event => {
ipc.on('vscode:keyboardLayoutChanged', () => {
KeyboardMapperFactory.INSTANCE._onKeyboardLayoutChanged();
});
// keyboard layout changed event
ipc.on('vscode:accessibilitySupportChanged', (event, accessibilitySupportEnabled: boolean) => {
ipc.on('vscode:accessibilitySupportChanged', (_event: any, accessibilitySupportEnabled: boolean) => {
browser.setAccessibilitySupport(accessibilitySupportEnabled ? platform.AccessibilitySupport.Enabled : platform.AccessibilitySupport.Disabled);
});
// Configuration changes
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onDidUpdateConfiguration(e)));
// Zoom level changes
this.updateWindowZoomLevel();
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('window.zoomLevel')) {
this.updateWindowZoomLevel();
}
}));
// Context menu support in input/textarea
window.document.addEventListener('contextmenu', e => this.onContextMenu(e));
@@ -261,12 +269,9 @@ export class ElectronWindow extends Themable {
}
}
private onDidUpdateConfiguration(event: IConfigurationChangeEvent): void {
if (!event.affectsConfiguration('window.zoomLevel')) {
return;
}
private updateWindowZoomLevel(): void {
const windowConfig: IWindowsConfiguration = this.configurationService.getConfiguration<IWindowsConfiguration>();
const windowConfig: IWindowsConfiguration = this.configurationService.getValue<IWindowsConfiguration>();
let newZoomLevel = 0;
if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') {
@@ -301,12 +306,12 @@ export class ElectronWindow extends Themable {
};
// Send over all extension viewlets when extensions are ready
this.extensionService.onReady().then(() => {
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
ipc.send('vscode:extensionViewlets', JSON.stringify(this.viewletService.getViewlets().filter(v => !!v.extensionId).map(v => { return { id: v.id, label: v.name }; })));
});
// Emit event when vscode has loaded
this.partService.joinCreation().then(() => {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
ipc.send('vscode:workbenchLoaded', this.windowService.getCurrentWindowId());
});
@@ -375,7 +380,7 @@ export class ElectronWindow extends Themable {
}
private resolveKeybindings(actionIds: string[]): TPromise<{ id: string; label: string, isNative: boolean; }[]> {
return TPromise.join([this.partService.joinCreation(), this.extensionService.onReady()]).then(() => {
return TPromise.join([this.lifecycleService.when(LifecyclePhase.Running), this.extensionService.whenInstalledExtensionsRegistered()]).then(() => {
return arrays.coalesce(actionIds.map(id => {
const binding = this.keybindingService.lookupKeybinding(id);
if (!binding) {
@@ -399,8 +404,25 @@ export class ElectronWindow extends Themable {
});
}
private onAddFolders(request: IAddFoldersRequest): void {
const foldersToAdd = request.foldersToAdd.map(folderToAdd => ({ uri: URI.file(folderToAdd.filePath) }));
private onAddFoldersRequest(request: IAddFoldersRequest): void {
// Buffer all pending requests
this.pendingFoldersToAdd.push(request);
// Delay the adding of folders a bit to buffer in case more requests are coming
if (!this.addFoldersScheduler.isScheduled()) {
this.addFoldersScheduler.schedule();
}
}
private doAddFolders(): void {
const foldersToAdd: IWorkspaceFolderCreationData[] = [];
this.pendingFoldersToAdd.forEach(request => {
foldersToAdd.push(...request.foldersToAdd.map(folderToAdd => ({ uri: URI.file(folderToAdd.filePath) })));
});
this.pendingFoldersToAdd = [];
this.workspaceEditingService.addFolders(foldersToAdd).done(null, errors.onUnexpectedError);
}
@@ -422,7 +444,7 @@ export class ElectronWindow extends Themable {
}
if (inputs.length) {
this.openResources(inputs, diffMode).done(null, errors.onUnexpectedError);
this.openResources(inputs, diffMode).then(null, errors.onUnexpectedError);
}
if (request.filesToWait && inputs.length) {
@@ -441,8 +463,8 @@ export class ElectronWindow extends Themable {
}
}
private openResources(resources: (IResourceInput | IUntitledResourceInput)[], diffMode: boolean): TPromise<IEditor | IEditor[]> {
return this.partService.joinCreation().then((): TPromise<IEditor | IEditor[]> => {
private openResources(resources: (IResourceInput | IUntitledResourceInput)[], diffMode: boolean): Thenable<IEditor | IEditor[]> {
return this.lifecycleService.when(LifecyclePhase.Running).then((): TPromise<IEditor | IEditor[]> => {
// In diffMode we open 2 resources as diff
if (diffMode && resources.length === 2) {

View File

@@ -8,25 +8,24 @@
import 'vs/css!./media/workbench';
import { localize } from 'vs/nls';
import { TPromise, ValueCallback } from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import Event, { Emitter, chain } from 'vs/base/common/event';
import Event, { Emitter } from 'vs/base/common/event';
import DOM = require('vs/base/browser/dom');
import { Builder, $ } from 'vs/base/browser/builder';
import { Delayer, RunOnceScheduler } from 'vs/base/common/async';
import * as browser from 'vs/base/browser/browser';
import { StopWatch } from 'vs/base/common/stopwatch';
import { startTimer } from 'vs/base/node/startupTimers';
import { time } from 'vs/base/common/performance';
import errors = require('vs/base/common/errors');
import { BackupFileService } from 'vs/workbench/services/backup/node/backupFileService';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { Registry } from 'vs/platform/registry/common/platform';
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
import { Position as EditorPosition, IResourceDiffInput, IUntitledResourceInput, IEditor, IResourceInput } from 'vs/platform/editor/common/editor';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { IEditorInputFactoryRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor';
import { HistoryService } from 'vs/workbench/services/history/browser/history';
import { HistoryService } from 'vs/workbench/services/history/electron-browser/history';
import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activitybarPart';
import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart';
import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart';
@@ -38,7 +37,7 @@ import { IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbe
import { PanelRegistry, Extensions as PanelExtensions } from 'vs/workbench/browser/panel';
import { QuickOpenController } from 'vs/workbench/browser/parts/quickopen/quickOpenController';
import { getServices } from 'vs/platform/instantiation/common/extensions';
import { Position, Parts, IPartService, ILayoutOptions } from 'vs/workbench/services/part/common/partService';
import { Position, Parts, IPartService, ILayoutOptions, Dimension } from 'vs/workbench/services/part/common/partService';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ContextMenuService } from 'vs/workbench/services/contextview/electron-browser/contextmenuService';
@@ -56,9 +55,8 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { ViewletService } from 'vs/workbench/services/viewlet/browser/viewletService';
import { RemoteFileService } from 'vs/workbench/services/files/electron-browser/remoteFileService';
import { IFileService } from 'vs/platform/files/common/files';
import { IListService, ListService } from 'vs/platform/list/browser/listService';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/node/configurationResolverService';
import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/electron-browser/configurationResolverService';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
import { WorkbenchMessageService } from 'vs/workbench/services/message/browser/messageService';
@@ -79,7 +77,8 @@ import { ProgressService2 } from 'vs/workbench/services/progress/browser/progres
import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { ILifecycleService, ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
import { ShutdownReason, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { LifecycleService } from 'vs/workbench/services/lifecycle/electron-browser/lifecycleService';
import { IWindowService, IWindowConfiguration as IWindowSettings, IWindowConfiguration, IPath } from 'vs/platform/windows/common/windows';
import { IMessageService } from 'vs/platform/message/common/message';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
@@ -87,7 +86,6 @@ import { IMenuService, SyncActionDescriptor } from 'vs/platform/actions/common/a
import { MenuService } from 'vs/platform/actions/common/menuService';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { OpenRecentAction, ToggleDevToolsAction, ReloadWindowAction, ShowPreviousWindowTab, MoveWindowTabToNewWindow, MergeAllWindowTabs, ShowNextWindowTab, ToggleWindowTabsBar } from 'vs/workbench/electron-browser/actions';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
@@ -97,7 +95,9 @@ import { FileDecorationsService } from 'vs/workbench/services/decorations/browse
import { IDecorationsService } from 'vs/workbench/services/decorations/browser/decorations';
import { ActivityService } from 'vs/workbench/services/activity/browser/activityService';
import URI from 'vs/base/common/uri';
import { IListService, ListService } from 'vs/platform/list/browser/listService';
import { domEvent } from 'vs/base/browser/event';
import { InputFocusedContext } from 'vs/platform/workbench/common/contextkeys';
// {{SQL CARBON EDIT}}
import { IConnectionManagementService, IConnectionDialogService, IErrorMessageService, IServerGroupController } from 'sql/parts/connection/common/connectionManagement';
@@ -172,11 +172,6 @@ export interface IWorkbenchStartedInfo {
restoredEditors: string[];
}
export interface IWorkbenchCallbacks {
onServicesCreated?: () => void;
onWorkbenchStarted?: (info: IWorkbenchStartedInfo) => void;
}
const Identifiers = {
WORKBENCH_CONTAINER: 'workbench.main.container',
TITLEBAR_PART: 'workbench.parts.titlebar',
@@ -187,24 +182,32 @@ const Identifiers = {
STATUSBAR_PART: 'workbench.parts.statusbar'
};
function getWorkbenchStateString(state: WorkbenchState): string {
switch (state) {
case WorkbenchState.EMPTY: return 'empty';
case WorkbenchState.FOLDER: return 'folder';
case WorkbenchState.WORKSPACE: return 'workspace';
}
}
/**
* The workbench creates and lays out all parts that make up the workbench.
*/
export class Workbench implements IPartService {
private static sidebarHiddenSettingKey = 'workbench.sidebar.hidden';
private static sidebarRestoreSettingKey = 'workbench.sidebar.restore';
private static panelHiddenSettingKey = 'workbench.panel.hidden';
private static zenModeActiveSettingKey = 'workbench.zenmode.active';
private static readonly sidebarHiddenStorageKey = 'workbench.sidebar.hidden';
private static readonly sidebarRestoreStorageKey = 'workbench.sidebar.restore';
private static readonly panelHiddenStorageKey = 'workbench.panel.hidden';
private static readonly zenModeActiveStorageKey = 'workbench.zenmode.active';
private static readonly panelPositionStorageKey = 'workbench.panel.location';
private static sidebarPositionConfigurationKey = 'workbench.sideBar.location';
private static panelPositionConfigurationKey = 'workbench.panel.location';
private static statusbarVisibleConfigurationKey = 'workbench.statusBar.visible';
private static activityBarVisibleConfigurationKey = 'workbench.activityBar.visible';
private static readonly sidebarPositionConfigurationKey = 'workbench.sideBar.location';
private static readonly statusbarVisibleConfigurationKey = 'workbench.statusBar.visible';
private static readonly activityBarVisibleConfigurationKey = 'workbench.activityBar.visible';
private static closeWhenEmptyConfigurationKey = 'window.closeWhenEmpty';
private static readonly closeWhenEmptyConfigurationKey = 'window.closeWhenEmpty';
private static fontAliasingConfigurationKey = 'workbench.fontAliasing';
private static readonly fontAliasingConfigurationKey = 'workbench.fontAliasing';
private _onTitleBarVisibilityChange: Emitter<void>;
@@ -234,9 +237,6 @@ export class Workbench implements IPartService {
private workbenchLayout: WorkbenchLayout;
private toDispose: IDisposable[];
private toShutdown: { shutdown: () => void; }[];
private callbacks: IWorkbenchCallbacks;
private creationPromise: TPromise<boolean>;
private creationPromiseComplete: ValueCallback;
private sideBarHidden: boolean;
private statusBarHidden: boolean;
private activityBarHidden: boolean;
@@ -263,13 +263,12 @@ export class Workbench implements IPartService {
container: HTMLElement,
configuration: IWindowConfiguration,
serviceCollection: ServiceCollection,
private lifecycleService: LifecycleService,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IStorageService private storageService: IStorageService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IMessageService private messageService: IMessageService,
@IConfigurationService private configurationService: WorkspaceService,
@ITelemetryService private telemetryService: ITelemetryService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IWindowService private windowService: IWindowService
) {
@@ -293,155 +292,165 @@ export class Workbench implements IPartService {
this.closeEmptyWindowScheduler = new RunOnceScheduler(() => this.onAllEditorsClosed(), 50);
this._onTitleBarVisibilityChange = new Emitter<void>();
this.creationPromise = new TPromise<boolean>(c => {
this.creationPromiseComplete = c;
});
}
public get onTitleBarVisibilityChange(): Event<void> {
return this._onTitleBarVisibilityChange.event;
}
public get onEditorLayout(): Event<void> {
return chain(this.editorPart.onLayout)
.map(() => void 0)
.event;
public get onEditorLayout(): Event<Dimension> {
return this.editorPart.onLayout;
}
/**
* Starts the workbench and creates the HTML elements on the container. A workbench can only be started
* once. Use the shutdown function to free up resources created by the workbench on startup.
*/
public startup(callbacks?: IWorkbenchCallbacks): void {
try {
this.workbenchStarted = true;
this.callbacks = callbacks;
public startup(): TPromise<IWorkbenchStartedInfo> {
this.workbenchStarted = true;
// Create Workbench
this.createWorkbench();
// Create Workbench Container
this.createWorkbench();
// Install some global actions
this.createGlobalActions();
// Install some global actions
this.createGlobalActions();
// Services
this.initServices();
if (this.callbacks && this.callbacks.onServicesCreated) {
this.callbacks.onServicesCreated();
// Services
this.initServices();
// Contexts
this.messagesVisibleContext = MessagesVisibleContext.bindTo(this.contextKeyService);
this.editorsVisibleContext = EditorsVisibleContext.bindTo(this.contextKeyService);
this.inZenMode = InZenModeContext.bindTo(this.contextKeyService);
this.sideBarVisibleContext = SidebarVisibleContext.bindTo(this.contextKeyService);
const inputFocused = InputFocusedContext.bindTo(this.contextKeyService);
const onWindowsFocusIn = domEvent(window, 'focusin', true);
onWindowsFocusIn(() => inputFocused.set(document.activeElement && (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA')), null, this.toDispose);
// Set workbench state context
const WorkbenchStateContext = new RawContextKey<string>('workbenchState', getWorkbenchStateString(this.configurationService.getWorkbenchState()));
const workbenchStateContext = WorkbenchStateContext.bindTo(this.contextKeyService);
const WorkspaceFolderCountContext = new RawContextKey<number>('workspaceFolderCount', this.configurationService.getWorkspace().folders.length);
const workspaceFolderCountContext = WorkspaceFolderCountContext.bindTo(this.contextKeyService);
this.toDispose.push(this.configurationService.onDidChangeWorkbenchState(() => workbenchStateContext.set(getWorkbenchStateString(this.configurationService.getWorkbenchState()))));
this.toDispose.push(this.configurationService.onDidChangeWorkspaceFolders(() => workspaceFolderCountContext.set(this.configurationService.getWorkspace().folders.length)));
// Register Listeners
this.registerListeners();
// Settings
this.initSettings();
// Create Workbench and Parts
this.renderWorkbench();
// Workbench Layout
this.createWorkbenchLayout();
// Restore Parts
return this.restoreParts();
}
private createWorkbench(): void {
this.workbenchContainer = $('.monaco-workbench-container');
this.workbench = $().div({
'class': `monaco-workbench ${isWindows ? 'windows' : isLinux ? 'linux' : 'mac'}`,
id: Identifiers.WORKBENCH_CONTAINER
}).appendTo(this.workbenchContainer);
}
private restoreParts(): TPromise<IWorkbenchStartedInfo> {
const restorePromises: TPromise<any>[] = [];
// Restore Editors
const editorRestoreStopWatch = StopWatch.create();
const editorRestoreClock = time('restore:editors');
const restoredEditors: string[] = [];
restorePromises.push(this.resolveEditorsToOpen().then(inputs => {
let editorOpenPromise: TPromise<IEditor[]>;
if (inputs.length) {
editorOpenPromise = this.editorService.openEditors(inputs.map(input => { return { input, position: EditorPosition.ONE }; }));
} else {
editorOpenPromise = this.editorPart.restoreEditors();
}
// Contexts
this.messagesVisibleContext = MessagesVisibleContext.bindTo(this.contextKeyService);
this.editorsVisibleContext = EditorsVisibleContext.bindTo(this.contextKeyService);
this.inZenMode = InZenModeContext.bindTo(this.contextKeyService);
this.sideBarVisibleContext = SidebarVisibleContext.bindTo(this.contextKeyService);
// update lifecycle *after* triggering the editor restore
this.lifecycleService.phase = LifecyclePhase.Restoring;
// Register Listeners
this.registerListeners();
return editorOpenPromise.then(editors => {
this.handleEditorBackground(); // make sure we show the proper background in the editor area
// Settings
this.initSettings();
editorRestoreClock.stop();
editorRestoreStopWatch.stop();
// Create Workbench and Parts
this.renderWorkbench();
// Workbench Layout
this.createWorkbenchLayout();
// Load composites and editors in parallel
const compositeAndEditorPromises: TPromise<any>[] = [];
// Restore last opened viewlet
let viewletRestoreStopWatch: StopWatch;
let viewletIdToRestore: string;
if (!this.sideBarHidden) {
this.sideBarVisibleContext.set(true);
if (this.shouldRestoreLastOpenedViewlet()) {
viewletIdToRestore = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE);
}
if (!viewletIdToRestore) {
viewletIdToRestore = this.viewletService.getDefaultViewletId();
}
viewletRestoreStopWatch = StopWatch.create();
const viewletTimer = startTimer('restore:viewlet');
compositeAndEditorPromises.push(viewletTimer.while(this.viewletService.openViewlet(viewletIdToRestore)).then(() => {
viewletRestoreStopWatch.stop();
}));
}
// Load Panel
const panelRegistry = Registry.as<PanelRegistry>(PanelExtensions.Panels);
const panelId = this.storageService.get(PanelPart.activePanelSettingsKey, StorageScope.WORKSPACE, panelRegistry.getDefaultPanelId());
if (!this.panelHidden && !!panelId) {
compositeAndEditorPromises.push(this.panelPart.openPanel(panelId, false));
}
// Load Editors
const editorRestoreStopWatch = StopWatch.create();
const restoredEditors: string[] = [];
const editorsTimer = startTimer('restore:editors');
compositeAndEditorPromises.push(editorsTimer.while(this.resolveEditorsToOpen().then(inputs => {
let editorOpenPromise: TPromise<IEditor[]>;
if (inputs.length) {
editorOpenPromise = this.editorService.openEditors(inputs.map(input => { return { input, position: EditorPosition.ONE }; }));
} else {
editorOpenPromise = this.editorPart.restoreEditors();
}
return editorOpenPromise.then(editors => {
this.handleEditorBackground(); // make sure we show the proper background in the editor area
editorRestoreStopWatch.stop();
for (const editor of editors) {
if (editor) {
if (editor.input) {
restoredEditors.push(editor.input.getName());
} else {
restoredEditors.push(`other:${editor.getId()}`);
}
for (const editor of editors) {
if (editor) {
if (editor.input) {
restoredEditors.push(editor.input.getName());
} else {
restoredEditors.push(`other:${editor.getId()}`);
}
}
});
})));
}
});
}));
if (this.storageService.getBoolean(Workbench.zenModeActiveSettingKey, StorageScope.WORKSPACE, false)) {
this.toggleZenMode(true);
// Restore Sidebar
let viewletRestoreStopWatch: StopWatch;
let viewletIdToRestore: string;
if (!this.sideBarHidden) {
this.sideBarVisibleContext.set(true);
if (this.shouldRestoreLastOpenedViewlet()) {
viewletIdToRestore = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE);
}
// Flag workbench as created once done
const workbenchDone = (error?: Error) => {
this.workbenchCreated = true;
this.creationPromiseComplete(true);
if (!viewletIdToRestore) {
viewletIdToRestore = this.viewletService.getDefaultViewletId();
}
if (this.callbacks && this.callbacks.onWorkbenchStarted) {
this.callbacks.onWorkbenchStarted({
customKeybindingsCount: this.keybindingService.customKeybindingsCount(),
restoreViewletDuration: viewletRestoreStopWatch ? Math.round(viewletRestoreStopWatch.elapsed()) : 0,
restoreEditorsDuration: Math.round(editorRestoreStopWatch.elapsed()),
pinnedViewlets: this.activitybarPart.getPinned(),
restoredViewlet: viewletIdToRestore,
restoredEditors
});
}
if (error) {
errors.onUnexpectedError(error);
}
};
// Join viewlet, panel and editor promises
TPromise.join(compositeAndEditorPromises).then(() => workbenchDone(), error => workbenchDone(error));
} catch (error) {
// Print out error
console.error(toErrorMessage(error, true));
// Rethrow
throw error;
viewletRestoreStopWatch = StopWatch.create();
const viewletRestoreClock = time('restore:viewlet');
restorePromises.push(this.viewletService.openViewlet(viewletIdToRestore).then(() => {
viewletRestoreStopWatch.stop();
viewletRestoreClock.stop();
}));
}
// Restore Panel
const panelRegistry = Registry.as<PanelRegistry>(PanelExtensions.Panels);
const panelId = this.storageService.get(PanelPart.activePanelSettingsKey, StorageScope.WORKSPACE, panelRegistry.getDefaultPanelId());
if (!this.panelHidden && !!panelId) {
restorePromises.push(this.panelPart.openPanel(panelId, false));
}
// Restore Zen Mode if active
if (this.storageService.getBoolean(Workbench.zenModeActiveStorageKey, StorageScope.WORKSPACE, false)) {
this.toggleZenMode(true);
}
const onRestored = (error?: Error): IWorkbenchStartedInfo => {
this.workbenchCreated = true;
if (error) {
errors.onUnexpectedError(error);
}
return {
customKeybindingsCount: this.keybindingService.customKeybindingsCount(),
restoreViewletDuration: viewletRestoreStopWatch ? Math.round(viewletRestoreStopWatch.elapsed()) : 0,
restoreEditorsDuration: Math.round(editorRestoreStopWatch.elapsed()),
pinnedViewlets: this.activitybarPart.getPinned(),
restoredViewlet: viewletIdToRestore,
restoredEditors
};
};
return TPromise.join(restorePromises).then(() => onRestored(), error => onRestored(error));
}
private createGlobalActions(): void {
@@ -454,7 +463,7 @@ export class Workbench implements IPartService {
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenRecentAction, OpenRecentAction.ID, OpenRecentAction.LABEL, { primary: isDeveloping ? null : KeyMod.CtrlCmd | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_R } }), 'File: Open Recent...', localize('file', "File"));
// Actions for macOS native tabs management (only when enabled)
const windowConfig = this.configurationService.getConfiguration<IWindowConfiguration>();
const windowConfig = this.configurationService.getValue<IWindowConfiguration>();
if (windowConfig && windowConfig.window && windowConfig.window.nativeTabs) {
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousWindowTab, ShowPreviousWindowTab.ID, ShowPreviousWindowTab.LABEL), 'Show Previous Window Tab');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowNextWindowTab, ShowNextWindowTab.ID, ShowNextWindowTab.LABEL), 'Show Next Window Tab');
@@ -658,6 +667,7 @@ export class Workbench implements IPartService {
this.toDispose.push(this.quickOpen);
this.toShutdown.push(this.quickOpen);
serviceCollection.set(IQuickOpenService, this.quickOpen);
// {{SQL CARBON EDIT}}
// SQL Tools services
serviceCollection.set(IAngularEventingService, this.instantiationService.createInstance(AngularEventingService));
@@ -697,7 +707,7 @@ export class Workbench implements IPartService {
this.toDispose.push(connectionManagementService);
this.toShutdown.push(connectionManagementService);
this.toShutdown.push(accountManagementService);
// Contributed services
const contributedServices = getServices();
for (let contributedService of contributedServices) {
@@ -706,7 +716,7 @@ export class Workbench implements IPartService {
// Set the some services to registries that have been created eagerly
Registry.as<IActionBarRegistry>(ActionBarExtensions.Actionbar).setInstantiationService(this.instantiationService);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).setInstantiationService(this.instantiationService);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).start(this.instantiationService, this.lifecycleService);
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).setInstantiationService(this.instantiationService);
this.instantiationService.createInstance(DefaultConfigurationExportHelper);
@@ -717,11 +727,11 @@ export class Workbench implements IPartService {
private initSettings(): void {
// Sidebar visibility
this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenSettingKey, StorageScope.WORKSPACE, this.contextService.getWorkbenchState() === WorkbenchState.EMPTY);
this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenStorageKey, StorageScope.WORKSPACE, this.contextService.getWorkbenchState() === WorkbenchState.EMPTY);
// Panel part visibility
const panelRegistry = Registry.as<PanelRegistry>(PanelExtensions.Panels);
this.panelHidden = this.storageService.getBoolean(Workbench.panelHiddenSettingKey, StorageScope.WORKSPACE, true);
this.panelHidden = this.storageService.getBoolean(Workbench.panelHiddenStorageKey, StorageScope.WORKSPACE, true);
if (!panelRegistry.getDefaultPanelId()) {
this.panelHidden = true; // we hide panel part if there is no default panel
}
@@ -731,7 +741,7 @@ export class Workbench implements IPartService {
this.sideBarPosition = (sideBarPosition === 'right') ? Position.RIGHT : Position.LEFT;
// Panel position
const panelPosition = this.configurationService.getValue<string>(Workbench.panelPositionConfigurationKey);
const panelPosition = this.storageService.get(Workbench.panelPositionStorageKey, StorageScope.WORKSPACE, 'bottom');
this.panelPosition = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM;
// Statusbar visibility
@@ -768,10 +778,6 @@ export class Workbench implements IPartService {
return this.workbenchCreated && this.workbenchStarted;
}
public joinCreation(): TPromise<boolean> {
return this.creationPromise;
}
public hasFocus(part: Parts): boolean {
const activeElement = document.activeElement;
if (!activeElement) {
@@ -845,7 +851,7 @@ export class Workbench implements IPartService {
return null; // not enabled when developing due to https://github.com/electron/electron/issues/3647
}
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>();
const windowConfig = this.configurationService.getValue<IWindowSettings>();
if (windowConfig && windowConfig.window) {
const useNativeTabs = windowConfig.window.nativeTabs;
if (useNativeTabs) {
@@ -857,6 +863,7 @@ export class Workbench implements IPartService {
return style;
}
}
// {{SQL CARBON EDIT}}
*/
return null;
@@ -894,7 +901,7 @@ export class Workbench implements IPartService {
}
// If sidebar becomes hidden, also hide the current active Viewlet if any
let promise = TPromise.as<any>(null);
let promise = TPromise.wrap<any>(null);
if (hidden && this.sidebarPart.getActiveViewlet()) {
promise = this.sidebarPart.hideActiveViewlet().then(() => {
const activeEditor = this.editorPart.getActiveEditor();
@@ -922,9 +929,9 @@ export class Workbench implements IPartService {
// Remember in settings
const defaultHidden = this.contextService.getWorkbenchState() === WorkbenchState.EMPTY;
if (hidden !== defaultHidden) {
this.storageService.store(Workbench.sidebarHiddenSettingKey, hidden ? 'true' : 'false', StorageScope.WORKSPACE);
this.storageService.store(Workbench.sidebarHiddenStorageKey, hidden ? 'true' : 'false', StorageScope.WORKSPACE);
} else {
this.storageService.remove(Workbench.sidebarHiddenSettingKey, StorageScope.WORKSPACE);
this.storageService.remove(Workbench.sidebarHiddenStorageKey, StorageScope.WORKSPACE);
}
// Layout
@@ -945,7 +952,7 @@ export class Workbench implements IPartService {
}
// If panel part becomes hidden, also hide the current active panel if any
let promise = TPromise.as<any>(null);
let promise = TPromise.wrap<any>(null);
if (hidden && this.panelPart.getActivePanel()) {
promise = this.panelPart.hideActivePanel().then(() => {
// Pass Focus to Editor if Panel part is now hidden
@@ -968,9 +975,9 @@ export class Workbench implements IPartService {
// Remember in settings
if (!hidden) {
this.storageService.store(Workbench.panelHiddenSettingKey, 'false', StorageScope.WORKSPACE);
this.storageService.store(Workbench.panelHiddenStorageKey, 'false', StorageScope.WORKSPACE);
} else {
this.storageService.remove(Workbench.panelHiddenSettingKey, StorageScope.WORKSPACE);
this.storageService.remove(Workbench.panelHiddenStorageKey, StorageScope.WORKSPACE);
}
// Layout
@@ -981,7 +988,7 @@ export class Workbench implements IPartService {
}
public toggleMaximizedPanel(): void {
this.workbenchLayout.layout({ toggleMaximizedPanel: true });
this.workbenchLayout.layout({ toggleMaximizedPanel: true, source: Parts.PANEL_PART });
}
public isPanelMaximized(): boolean {
@@ -992,9 +999,9 @@ export class Workbench implements IPartService {
return this.sideBarPosition;
}
private setSideBarPosition(position: Position): void {
public setSideBarPosition(position: Position): void {
if (this.sideBarHidden) {
this.setSideBarHidden(false, true /* Skip Layout */).done(undefined, errors.onUnexpectedError);
this.setSideBarHidden(false, true /* Skip Layout */).done(void 0, errors.onUnexpectedError);
}
const newPositionValue = (position === Position.LEFT) ? 'left' : 'right';
@@ -1019,24 +1026,23 @@ export class Workbench implements IPartService {
return this.panelPosition;
}
private setPanelPosition(position: Position): void {
if (this.panelHidden) {
this.setPanelHidden(false, true /* Skip Layout */).done(undefined, errors.onUnexpectedError);
}
public setPanelPosition(position: Position): TPromise<void> {
return (this.panelHidden ? this.setPanelHidden(false, true /* Skip Layout */) : TPromise.as(undefined)).then(() => {
const newPositionValue = (position === Position.BOTTOM) ? 'bottom' : 'right';
const oldPositionValue = (this.panelPosition === Position.BOTTOM) ? 'bottom' : 'right';
this.panelPosition = position;
this.storageService.store(Workbench.panelPositionStorageKey, Position[this.panelPosition].toLowerCase(), StorageScope.WORKSPACE);
const newPositionValue = (position === Position.BOTTOM) ? 'bottom' : 'right';
const oldPositionValue = (this.panelPosition === Position.BOTTOM) ? 'bottom' : 'right';
this.panelPosition = position;
// Adjust CSS
this.panelPart.getContainer().removeClass(oldPositionValue);
this.panelPart.getContainer().addClass(newPositionValue);
// Adjust CSS
this.panelPart.getContainer().removeClass(oldPositionValue);
this.panelPart.getContainer().addClass(newPositionValue);
// Update Styles
this.panelPart.updateStyles();
// Update Styles
this.panelPart.updateStyles();
// Layout
this.workbenchLayout.layout();
// Layout
this.workbenchLayout.layout();
});
}
private setFontAliasing(aliasing: string) {
@@ -1068,16 +1074,16 @@ export class Workbench implements IPartService {
// Restore sidebar if we are being shutdown as a matter of a reload
if (reason === ShutdownReason.RELOAD) {
this.storageService.store(Workbench.sidebarRestoreSettingKey, 'true', StorageScope.WORKSPACE);
this.storageService.store(Workbench.sidebarRestoreStorageKey, 'true', StorageScope.WORKSPACE);
}
// Preserve zen mode only on reload. Real quit gets out of zen mode so novice users do not get stuck in zen mode.
const zenConfig = this.configurationService.getConfiguration<IZenModeSettings>('zenMode');
const zenConfig = this.configurationService.getValue<IZenModeSettings>('zenMode');
const zenModeActive = (zenConfig.restore || reason === ShutdownReason.RELOAD) && this.zenMode.active;
if (zenModeActive) {
this.storageService.store(Workbench.zenModeActiveSettingKey, true, StorageScope.WORKSPACE);
this.storageService.store(Workbench.zenModeActiveStorageKey, true, StorageScope.WORKSPACE);
} else {
this.storageService.remove(Workbench.zenModeActiveSettingKey, StorageScope.WORKSPACE);
this.storageService.remove(Workbench.zenModeActiveStorageKey, StorageScope.WORKSPACE);
}
// Pass shutdown on to each participant
@@ -1194,12 +1200,6 @@ export class Workbench implements IPartService {
this.setSideBarPosition(newSidebarPosition);
}
const newPanelPositionValue = this.configurationService.getValue<string>(Workbench.panelPositionConfigurationKey);
const newPanelPosition = (newPanelPositionValue === 'right') ? Position.RIGHT : Position.BOTTOM;
if (newPanelPosition !== this.getPanelPosition()) {
this.setPanelPosition(newPanelPosition);
}
const fontAliasing = this.configurationService.getValue<string>(Workbench.fontAliasingConfigurationKey);
if (fontAliasing !== this.fontAliasing) {
this.setFontAliasing(fontAliasing);
@@ -1236,13 +1236,6 @@ export class Workbench implements IPartService {
this.toDispose.push(this.workbenchLayout);
}
private createWorkbench(): void {
// Create Workbench DIV Off-DOM
this.workbenchContainer = $('.monaco-workbench-container');
this.workbench = $().div({ 'class': 'monaco-workbench ' + (isWindows ? 'windows' : isLinux ? 'linux' : 'mac'), id: Identifiers.WORKBENCH_CONTAINER }).appendTo(this.workbenchContainer);
}
private renderWorkbench(): void {
// Apply sidebar state as CSS class
@@ -1343,18 +1336,6 @@ export class Workbench implements IPartService {
this.statusbarPart.create(statusbarContainer);
}
public getEditorPart(): EditorPart {
return this.editorPart;
}
public getSidebarPart(): SidebarPart {
return this.sidebarPart;
}
public getPanelPart(): PanelPart {
return this.panelPart;
}
public getInstantiationService(): IInstantiationService {
return this.instantiationService;
}
@@ -1381,13 +1362,13 @@ export class Workbench implements IPartService {
// Check if zen mode transitioned to full screen and if now we are out of zen mode -> we need to go out of full screen
let toggleFullScreen = false;
if (this.zenMode.active) {
const config = this.configurationService.getConfiguration<IZenModeSettings>('zenMode');
const config = this.configurationService.getValue<IZenModeSettings>('zenMode');
toggleFullScreen = !browser.isFullscreen() && config.fullScreen;
this.zenMode.transitionedToFullScreen = toggleFullScreen;
this.zenMode.wasSideBarVisible = this.isVisible(Parts.SIDEBAR_PART);
this.zenMode.wasPanelVisible = this.isVisible(Parts.PANEL_PART);
this.setPanelHidden(true, true).done(undefined, errors.onUnexpectedError);
this.setSideBarHidden(true, true).done(undefined, errors.onUnexpectedError);
this.setPanelHidden(true, true).done(void 0, errors.onUnexpectedError);
this.setSideBarHidden(true, true).done(void 0, errors.onUnexpectedError);
if (config.hideActivityBar) {
this.setActivityBarHidden(true, true);
@@ -1402,11 +1383,11 @@ export class Workbench implements IPartService {
}
} else {
if (this.zenMode.wasPanelVisible) {
this.setPanelHidden(false, true).done(undefined, errors.onUnexpectedError);
this.setPanelHidden(false, true).done(void 0, errors.onUnexpectedError);
}
if (this.zenMode.wasSideBarVisible) {
this.setSideBarHidden(false, true).done(undefined, errors.onUnexpectedError);
this.setSideBarHidden(false, true).done(void 0, errors.onUnexpectedError);
}
// Status bar and activity bar visibility come from settings -> update their visibility.
@@ -1427,7 +1408,7 @@ export class Workbench implements IPartService {
}
if (toggleFullScreen) {
this.windowService.toggleFullScreen().done(undefined, errors.onUnexpectedError);
this.windowService.toggleFullScreen().done(void 0, errors.onUnexpectedError);
}
}
@@ -1451,9 +1432,9 @@ export class Workbench implements IPartService {
return true; // always restore sidebar when we are in development mode
}
const restore = this.storageService.getBoolean(Workbench.sidebarRestoreSettingKey, StorageScope.WORKSPACE);
const restore = this.storageService.getBoolean(Workbench.sidebarRestoreStorageKey, StorageScope.WORKSPACE);
if (restore) {
this.storageService.remove(Workbench.sidebarRestoreSettingKey, StorageScope.WORKSPACE); // only support once
this.storageService.remove(Workbench.sidebarRestoreStorageKey, StorageScope.WORKSPACE); // only support once
}
return restore;