mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
'use strict';
|
||||
|
||||
function createModuleDescription(name, exclude) {
|
||||
var result = {};
|
||||
var excludes = ['vs/css', 'vs/nls'];
|
||||
const result = {};
|
||||
|
||||
let excludes = ['vs/css', 'vs/nls'];
|
||||
result.name = name;
|
||||
if (Array.isArray(exclude) && exclude.length > 0) {
|
||||
excludes = excludes.concat(exclude);
|
||||
|
||||
@@ -10,13 +10,12 @@ import { $ } from 'vs/base/browser/dom';
|
||||
import * as collections from 'vs/base/common/collections';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
import product from 'vs/platform/node/product';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import * as os from 'os';
|
||||
import { debounce } from 'vs/base/common/decorators';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Client as ElectronIPCClient } from 'vs/base/parts/ipc/electron-browser/ipc.electron-browser';
|
||||
import { getDelayedChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
@@ -28,7 +27,8 @@ import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
|
||||
import { WindowsChannelClient } from 'vs/platform/windows/node/windowsIpc';
|
||||
import { WindowsService } from 'vs/platform/windows/electron-browser/windowsService';
|
||||
import { MainProcessService, IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { IssueReporterModel } from 'vs/code/electron-browser/issue/issueReporterModel';
|
||||
import { IssueReporterData, IssueReporterStyles, IssueType, ISettingsSearchIssueReporterData, IssueReporterFeatures, IssueReporterExtensionData } from 'vs/platform/issue/common/issue';
|
||||
@@ -64,14 +64,14 @@ export class IssueReporter extends Disposable {
|
||||
private environmentService: IEnvironmentService;
|
||||
private telemetryService: ITelemetryService;
|
||||
private logService: ILogService;
|
||||
private issueReporterModel: IssueReporterModel;
|
||||
private readonly issueReporterModel: IssueReporterModel;
|
||||
private numberOfSearchResultsDisplayed = 0;
|
||||
private receivedSystemInfo = false;
|
||||
private receivedPerformanceInfo = false;
|
||||
private shouldQueueSearch = false;
|
||||
private hasBeenSubmitted = false;
|
||||
|
||||
private previewButton: Button;
|
||||
private readonly previewButton: Button;
|
||||
|
||||
constructor(configuration: IssueReporterConfiguration) {
|
||||
super();
|
||||
@@ -273,14 +273,14 @@ export class IssueReporter extends Disposable {
|
||||
|
||||
private initServices(configuration: IWindowConfiguration): void {
|
||||
const serviceCollection = new ServiceCollection();
|
||||
const mainProcessClient = new ElectronIPCClient(String(`window${configuration.windowId}`));
|
||||
const mainProcessService = new MainProcessService(configuration.windowId);
|
||||
serviceCollection.set(IMainProcessService, mainProcessService);
|
||||
|
||||
const windowsChannel = mainProcessClient.getChannel('windows');
|
||||
serviceCollection.set(IWindowsService, new WindowsChannelClient(windowsChannel));
|
||||
serviceCollection.set(IWindowsService, new WindowsService(mainProcessService));
|
||||
this.environmentService = new EnvironmentService(configuration, configuration.execPath);
|
||||
|
||||
const logService = createSpdLogService(`issuereporter${configuration.windowId}`, getLogLevel(this.environmentService), this.environmentService.logsPath);
|
||||
const logLevelClient = new LogLevelSetterChannelClient(mainProcessClient.getChannel('loglevel'));
|
||||
const logLevelClient = new LogLevelSetterChannelClient(mainProcessService.getChannel('loglevel'));
|
||||
this.logService = new FollowerLogService(logLevelClient, logService);
|
||||
|
||||
const sharedProcess = (<IWindowsService>serviceCollection.get(IWindowsService)).whenSharedProcessReady()
|
||||
@@ -311,6 +311,7 @@ export class IssueReporter extends Disposable {
|
||||
ipcRenderer.send('vscode:issuePerformanceInfoRequest');
|
||||
}
|
||||
this.updatePreviewButtonState();
|
||||
this.setSourceOptions();
|
||||
this.render();
|
||||
});
|
||||
|
||||
@@ -342,8 +343,20 @@ export class IssueReporter extends Disposable {
|
||||
}
|
||||
|
||||
this.addEventListener('issue-source', 'change', (e: Event) => {
|
||||
const fileOnExtension = JSON.parse((<HTMLInputElement>e.target).value);
|
||||
this.issueReporterModel.update({ fileOnExtension: fileOnExtension, includeExtensions: !fileOnExtension });
|
||||
const value = (<HTMLInputElement>e.target).value;
|
||||
const problemSourceHelpText = this.getElementById('problem-source-help-text')!;
|
||||
if (value === '') {
|
||||
this.issueReporterModel.update({ fileOnExtension: undefined });
|
||||
show(problemSourceHelpText);
|
||||
this.clearSearchResults();
|
||||
this.render();
|
||||
return;
|
||||
} else {
|
||||
hide(problemSourceHelpText);
|
||||
}
|
||||
|
||||
const fileOnExtension = JSON.parse(value);
|
||||
this.issueReporterModel.update({ fileOnExtension: fileOnExtension });
|
||||
this.render();
|
||||
|
||||
const title = (<HTMLInputElement>this.getElementById('issue-title')).value;
|
||||
@@ -360,7 +373,7 @@ export class IssueReporter extends Disposable {
|
||||
this.issueReporterModel.update({ issueDescription });
|
||||
|
||||
// Only search for extension issues on title change
|
||||
if (!this.issueReporterModel.fileOnExtension()) {
|
||||
if (this.issueReporterModel.fileOnExtension() === false) {
|
||||
const title = (<HTMLInputElement>this.getElementById('issue-title')).value;
|
||||
this.searchVSCodeIssues(title, issueDescription);
|
||||
}
|
||||
@@ -375,7 +388,12 @@ export class IssueReporter extends Disposable {
|
||||
hide(lengthValidationMessage);
|
||||
}
|
||||
|
||||
if (this.issueReporterModel.fileOnExtension()) {
|
||||
const fileOnExtension = this.issueReporterModel.fileOnExtension();
|
||||
if (fileOnExtension === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileOnExtension) {
|
||||
this.searchExtensionIssues(title);
|
||||
} else {
|
||||
const description = this.issueReporterModel.getData().issueDescription;
|
||||
@@ -663,6 +681,45 @@ export class IssueReporter extends Disposable {
|
||||
}
|
||||
|
||||
typeSelect.value = issueType.toString();
|
||||
|
||||
this.setSourceOptions();
|
||||
}
|
||||
|
||||
private makeOption(value: string, description: string, disabled: boolean): HTMLOptionElement {
|
||||
const option: HTMLOptionElement = document.createElement('option');
|
||||
option.disabled = disabled;
|
||||
option.value = value;
|
||||
option.textContent = description;
|
||||
|
||||
return option;
|
||||
}
|
||||
|
||||
private setSourceOptions(): void {
|
||||
const sourceSelect = this.getElementById('issue-source')! as HTMLSelectElement;
|
||||
const selected = sourceSelect.selectedIndex;
|
||||
sourceSelect.innerHTML = '';
|
||||
const { issueType } = this.issueReporterModel.getData();
|
||||
if (issueType === IssueType.FeatureRequest) {
|
||||
sourceSelect.append(...[
|
||||
this.makeOption('', localize('selectSource', "Select source"), true),
|
||||
this.makeOption('false', localize('vscode', "Visual Studio Code"), false),
|
||||
this.makeOption('true', localize('extension', "An extension"), false)
|
||||
]);
|
||||
} else {
|
||||
sourceSelect.append(...[
|
||||
this.makeOption('', localize('selectSource', "Select source"), true),
|
||||
this.makeOption('false', localize('vscode', "Visual Studio Code"), false),
|
||||
this.makeOption('true', localize('extension', "An extension"), false),
|
||||
this.makeOption('', localize('unknown', "Don't Know"), false)
|
||||
]);
|
||||
}
|
||||
|
||||
if (selected !== -1 && selected < sourceSelect.options.length) {
|
||||
sourceSelect.selectedIndex = selected;
|
||||
} else {
|
||||
sourceSelect.selectedIndex = 0;
|
||||
hide(this.getElementById('problem-source-help-text'));
|
||||
}
|
||||
}
|
||||
|
||||
private renderBlocks(): void {
|
||||
@@ -677,7 +734,6 @@ export class IssueReporter extends Disposable {
|
||||
const settingsSearchResultsBlock = document.querySelector('.block-settingsSearchResults');
|
||||
|
||||
const problemSource = this.getElementById('problem-source')!;
|
||||
const problemSourceHelpText = this.getElementById('problem-source-help-text')!;
|
||||
const descriptionTitle = this.getElementById('issue-description-label')!;
|
||||
const descriptionSubtitle = this.getElementById('issue-description-subtitle')!;
|
||||
const extensionSelector = this.getElementById('extension-selection')!;
|
||||
@@ -691,7 +747,6 @@ export class IssueReporter extends Disposable {
|
||||
hide(searchedExtensionsBlock);
|
||||
hide(settingsSearchResultsBlock);
|
||||
hide(problemSource);
|
||||
hide(problemSourceHelpText);
|
||||
hide(extensionSelector);
|
||||
|
||||
if (issueType === IssueType.Bug) {
|
||||
@@ -703,7 +758,6 @@ export class IssueReporter extends Disposable {
|
||||
show(extensionSelector);
|
||||
} else {
|
||||
show(extensionsBlock);
|
||||
show(problemSourceHelpText);
|
||||
}
|
||||
|
||||
descriptionTitle.innerHTML = `${localize('stepsToReproduce', "Steps to Reproduce")} <span class="required-input">*</span>`;
|
||||
@@ -719,7 +773,6 @@ export class IssueReporter extends Disposable {
|
||||
show(extensionSelector);
|
||||
} else {
|
||||
show(extensionsBlock);
|
||||
show(problemSourceHelpText);
|
||||
}
|
||||
|
||||
descriptionTitle.innerHTML = `${localize('stepsToReproduce', "Steps to Reproduce")} <span class="required-input">*</span>`;
|
||||
@@ -783,6 +836,10 @@ export class IssueReporter extends Disposable {
|
||||
this.validateInput('description');
|
||||
});
|
||||
|
||||
this.addEventListener('issue-source', 'change', _ => {
|
||||
this.validateInput('issue-source');
|
||||
});
|
||||
|
||||
if (this.issueReporterModel.fileOnExtension()) {
|
||||
this.addEventListener('extension-selector', 'change', _ => {
|
||||
this.validateInput('extension-selector');
|
||||
|
||||
@@ -34,7 +34,7 @@ export interface IssueReporterData {
|
||||
}
|
||||
|
||||
export class IssueReporterModel {
|
||||
private _data: IssueReporterData;
|
||||
private readonly _data: IssueReporterData;
|
||||
|
||||
constructor(initialData?: Partial<IssueReporterData>) {
|
||||
const defaultData = {
|
||||
@@ -73,12 +73,12 @@ ${this.getInfos()}
|
||||
<!-- generated by issue reporter -->`;
|
||||
}
|
||||
|
||||
fileOnExtension(): boolean {
|
||||
fileOnExtension(): boolean | undefined {
|
||||
const fileOnExtensionSupported = this._data.issueType === IssueType.Bug
|
||||
|| this._data.issueType === IssueType.PerformanceIssue
|
||||
|| this._data.issueType === IssueType.FeatureRequest;
|
||||
|
||||
return !!(fileOnExtensionSupported && this._data.fileOnExtension);
|
||||
return fileOnExtensionSupported && this._data.fileOnExtension;
|
||||
}
|
||||
|
||||
private getExtensionVersion(): string {
|
||||
@@ -122,7 +122,7 @@ ${this.getInfos()}
|
||||
}
|
||||
|
||||
if (this._data.issueType === IssueType.Bug || this._data.issueType === IssueType.PerformanceIssue) {
|
||||
if (this._data.includeExtensions) {
|
||||
if (!this._data.fileOnExtension && this._data.includeExtensions) {
|
||||
info += this.generateExtensionsMd();
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ ${this._data.workspaceInfo};
|
||||
return 'Extensions: none' + themeExclusionStr;
|
||||
}
|
||||
|
||||
let tableHeader = `Extension|Author (truncated)|Version
|
||||
const tableHeader = `Extension|Author (truncated)|Version
|
||||
---|---|---`;
|
||||
const table = this._data.enabledNonThemeExtesions.map(e => {
|
||||
return `${e.name}|${e.publisher.substr(0, 3)}|${e.version}`;
|
||||
@@ -227,7 +227,7 @@ Literal matches: ${this._data.filterResultCount}`;
|
||||
return `No fuzzy results`;
|
||||
}
|
||||
|
||||
let tableHeader = `Setting|Extension|Score
|
||||
const tableHeader = `Setting|Extension|Score
|
||||
---|---|---`;
|
||||
const table = this._data.actualSearchResults.map(setting => {
|
||||
return `${setting.key}|${setting.extensionId}|${String(setting.score).slice(0, 5)}`;
|
||||
|
||||
@@ -19,13 +19,11 @@ export default (): string => `
|
||||
</div>
|
||||
|
||||
<div class="input-group" id="problem-source">
|
||||
<label class="inline-label" for="issue-source">${escape(localize('issueSourceLabel', "File on"))}</label>
|
||||
<select id="issue-source" class="inline-form-control">
|
||||
<!-- {{ SQL CARBON EDIT }} -->
|
||||
<option value="false">${escape(localize('azuredatastudio', "Azure Data Studio"))}</option>
|
||||
<option value="true">${escape(localize('extension', "An Extension"))}</option>
|
||||
<label class="inline-label" for="issue-source">${escape(localize('issueSourceLabel', "File on"))}<span class="required-input">*</span></label>
|
||||
<select id="issue-source" class="inline-form-control" required>
|
||||
<!-- To be dynamically filled -->
|
||||
</select>
|
||||
<div id="problem-source-help-text" class="instructions">${escape(localize('disableExtensionsLabelText', "Try to reproduce the problem after {0}. If the problem only reproduces when extensions are active, it is likely an issue with an extension."))
|
||||
<div id="problem-source-help-text" class="instructions hidden">${escape(localize('disableExtensionsLabelText', "Try to reproduce the problem after {0}. If the problem only reproduces when extensions are active, it is likely an issue with an extension."))
|
||||
.replace('{0}', `<span tabIndex=0 role="button" id="disableExtensions" class="workbenchCommand">${escape(localize('disableExtensions', "disabling all extensions and reloading the window"))}</span>`)}
|
||||
</div>
|
||||
|
||||
@@ -126,4 +124,4 @@ export default (): string => `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
</div>`;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { listProcesses, ProcessItem } from 'vs/base/node/ps';
|
||||
import { webFrame, ipcRenderer, clipboard } from 'electron';
|
||||
import { repeat } from 'vs/base/common/strings';
|
||||
import { totalmem } from 'os';
|
||||
import product from 'vs/platform/node/product';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ProcessExplorerStyles, ProcessExplorerData } from 'vs/platform/issue/common/issue';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { NodeCachedDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner';
|
||||
import { LanguagePackCachedDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/languagePackCachedDataCleaner';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { StorageDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner';
|
||||
import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner';
|
||||
|
||||
export function createSharedProcessContributions(service: IInstantiationService): IDisposable {
|
||||
return combinedDisposable([
|
||||
service.createInstance(NodeCachedDataCleaner),
|
||||
service.createInstance(LanguagePackCachedDataCleaner),
|
||||
service.createInstance(StorageDataCleaner),
|
||||
service.createInstance(LogsDataCleaner)
|
||||
]);
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import product from 'vs/platform/node/product';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -57,15 +57,15 @@ export class LanguagePackCachedDataCleaner {
|
||||
? 1000 * 60 * 60 * 24 * 7 // roughly 1 week
|
||||
: 1000 * 60 * 60 * 24 * 30 * 3; // roughly 3 months
|
||||
try {
|
||||
let installed: IStringDictionary<boolean> = Object.create(null);
|
||||
const installed: IStringDictionary<boolean> = Object.create(null);
|
||||
const metaData: LanguagePackFile = JSON.parse(await pfs.readFile(path.join(this._environmentService.userDataPath, 'languagepacks.json'), 'utf8'));
|
||||
for (let locale of Object.keys(metaData)) {
|
||||
let entry = metaData[locale];
|
||||
const entry = metaData[locale];
|
||||
installed[`${entry.hash}.${locale}`] = true;
|
||||
}
|
||||
// Cleanup entries for language packs that aren't installed anymore
|
||||
const cacheDir = path.join(this._environmentService.userDataPath, 'clp');
|
||||
let exists = await pfs.exists(cacheDir);
|
||||
const exists = await pfs.exists(cacheDir);
|
||||
if (!exists) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { join, dirname, basename } from 'path';
|
||||
import { join, dirname, basename } from 'vs/base/common/path';
|
||||
import { readdir, rimraf } from 'vs/base/node/pfs';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { basename, dirname, join } from 'path';
|
||||
import { basename, dirname, join } from 'vs/base/common/path';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { readdir, rimraf, stat } from 'vs/base/node/pfs';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import product from 'vs/platform/node/product';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
|
||||
export class NodeCachedDataCleaner {
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { join } from 'path';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { readdir, readFile, rimraf } from 'vs/base/node/pfs';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/node/product';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import { serve, Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
@@ -28,9 +28,8 @@ import { TelemetryAppenderChannel } from 'vs/platform/telemetry/node/telemetryIp
|
||||
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
|
||||
import { IWindowsService, ActiveWindowManager } from 'vs/platform/windows/common/windows';
|
||||
import { WindowsChannelClient } from 'vs/platform/windows/node/windowsIpc';
|
||||
import { WindowsService } from 'vs/platform/windows/electron-browser/windowsService';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { createSharedProcessContributions } from 'vs/code/electron-browser/sharedProcess/contrib/contributions';
|
||||
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
|
||||
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { LogLevelSetterChannelClient, FollowerLogService } from 'vs/platform/log/node/logIpc';
|
||||
@@ -39,10 +38,17 @@ import { ILocalizationsService } from 'vs/platform/localizations/common/localiza
|
||||
import { LocalizationsChannel } from 'vs/platform/localizations/node/localizationsIpc';
|
||||
import { DialogChannelClient } from 'vs/platform/dialogs/node/dialogIpc';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { DownloadService } from 'vs/platform/download/node/downloadService';
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { StaticRouter } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { NodeCachedDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/nodeCachedDataCleaner';
|
||||
import { LanguagePackCachedDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/languagePackCachedDataCleaner';
|
||||
import { StorageDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/storageDataCleaner';
|
||||
import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
||||
export interface ISharedProcessConfiguration {
|
||||
readonly machineId: string;
|
||||
@@ -60,6 +66,20 @@ interface ISharedProcessInitData {
|
||||
|
||||
const eventPrefix = 'monacoworkbench';
|
||||
|
||||
class MainProcessService implements IMainProcessService {
|
||||
constructor(private server: Server, private mainRouter: StaticRouter) { }
|
||||
|
||||
_serviceBrand: ServiceIdentifier<any>;
|
||||
|
||||
getChannel(channelName: string): IChannel {
|
||||
return this.server.getChannel(channelName, this.mainRouter);
|
||||
}
|
||||
|
||||
registerChannel(channelName: string, channel: IServerChannel<string>): void {
|
||||
this.server.registerChannel(channelName, channel);
|
||||
}
|
||||
}
|
||||
|
||||
function main(server: Server, initData: ISharedProcessInitData, configuration: ISharedProcessConfiguration): void {
|
||||
const services = new ServiceCollection();
|
||||
|
||||
@@ -86,8 +106,10 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
||||
services.set(IRequestService, new SyncDescriptor(RequestService));
|
||||
services.set(IDownloadService, new SyncDescriptor(DownloadService));
|
||||
|
||||
const windowsChannel = server.getChannel('windows', mainRouter);
|
||||
const windowsService = new WindowsChannelClient(windowsChannel);
|
||||
const mainProcessService = new MainProcessService(server, mainRouter);
|
||||
services.set(IMainProcessService, mainProcessService);
|
||||
|
||||
const windowsService = new WindowsService(mainProcessService);
|
||||
services.set(IWindowsService, windowsService);
|
||||
|
||||
const activeWindowManager = new ActiveWindowManager(windowsService);
|
||||
@@ -135,14 +157,21 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
|
||||
const channel = new ExtensionManagementChannel(extensionManagementService, () => null);
|
||||
server.registerChannel('extensions', channel);
|
||||
|
||||
// clean up deprecated extensions
|
||||
(extensionManagementService as ExtensionManagementService).removeDeprecatedExtensions();
|
||||
|
||||
const localizationsService = accessor.get(ILocalizationsService);
|
||||
const localizationsChannel = new LocalizationsChannel(localizationsService);
|
||||
server.registerChannel('localizations', localizationsChannel);
|
||||
|
||||
createSharedProcessContributions(instantiationService2);
|
||||
disposables.push(combinedDisposable([
|
||||
// clean up deprecated extensions
|
||||
toDisposable(() => (extensionManagementService as ExtensionManagementService).removeDeprecatedExtensions()),
|
||||
// update localizations cache
|
||||
toDisposable(() => (localizationsService as LocalizationsService).update()),
|
||||
// other cache clean ups
|
||||
instantiationService2.createInstance(NodeCachedDataCleaner),
|
||||
instantiationService2.createInstance(LanguagePackCachedDataCleaner),
|
||||
instantiationService2.createInstance(StorageDataCleaner),
|
||||
instantiationService2.createInstance(LogsDataCleaner)
|
||||
]));
|
||||
disposables.push(extensionManagementService as ExtensionManagementService);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: vscode-remote:; media-src 'none'; child-src 'self'; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https:;">
|
||||
-->
|
||||
</head>
|
||||
<body class="monaco-shell vs-dark" aria-label="">
|
||||
<body class="vs-dark" aria-label="">
|
||||
</body>
|
||||
|
||||
<!-- // {{SQL CARBON EDIT}} -->
|
||||
|
||||
@@ -42,7 +42,7 @@ bootstrapWindow.load([
|
||||
perf.mark('main/startup');
|
||||
|
||||
// @ts-ignore
|
||||
return require('vs/workbench/electron-browser/main').startup(configuration);
|
||||
return require('vs/workbench/electron-browser/main').main(configuration);
|
||||
});
|
||||
}, {
|
||||
removeDeveloperKeybindingsAfterLoad: true,
|
||||
@@ -57,7 +57,6 @@ bootstrapWindow.load([
|
||||
onNodeCachedData.push(arguments);
|
||||
};
|
||||
}
|
||||
|
||||
},
|
||||
beforeRequire: function () {
|
||||
perf.mark('willLoadWorkbenchMain');
|
||||
@@ -71,10 +70,12 @@ function showPartsSplash(configuration) {
|
||||
perf.mark('willShowPartsSplash');
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(configuration.partsSplashData);
|
||||
} catch (e) {
|
||||
// ignore
|
||||
if (typeof configuration.partsSplashPath === 'string') {
|
||||
try {
|
||||
data = JSON.parse(require('fs').readFileSync(configuration.partsSplashPath, 'utf8'));
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
// high contrast mode has been turned on from the outside, e.g OS -> ignore stored colors and layouts
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body class="monaco-shell vs-dark" aria-label="">
|
||||
</body>
|
||||
|
||||
<!-- Startup via workbench.nodeless.js -->
|
||||
<script src="workbench.nodeless.js"></script>
|
||||
</html>
|
||||
67
src/vs/code/electron-browser/workbench/workbench.nodeless.js
Normal file
67
src/vs/code/electron-browser/workbench/workbench.nodeless.js
Normal file
@@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
||||
function uriFromPath(_path) {
|
||||
let pathName = _path.replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = '/' + pathName;
|
||||
}
|
||||
|
||||
let uri;
|
||||
if (navigator.userAgent.indexOf('Windows') >= 0 && pathName.startsWith('//')) { // specially handle Windows UNC paths
|
||||
uri = encodeURI('file:' + pathName);
|
||||
} else {
|
||||
uri = encodeURI('file://' + pathName);
|
||||
}
|
||||
|
||||
return uri.replace(/#/g, '%23');
|
||||
}
|
||||
|
||||
function parseURLQueryArgs() {
|
||||
const search = window.location.search || '';
|
||||
|
||||
return search.split(/[?&]/)
|
||||
.filter(function (param) { return !!param; })
|
||||
.map(function (param) { return param.split('='); })
|
||||
.filter(function (param) { return param.length === 2; })
|
||||
.reduce(function (r, param) { r[param[0]] = decodeURIComponent(param[1]); return r; }, {});
|
||||
}
|
||||
|
||||
function loadScript(path, callback) {
|
||||
let script = document.createElement('script');
|
||||
script.onload = callback;
|
||||
script.async = true;
|
||||
script.type = 'text/javascript';
|
||||
script.src = path;
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
loadScript('../../../../../out/vs/loader.js', function () {
|
||||
|
||||
const args = parseURLQueryArgs();
|
||||
const configuration = JSON.parse(args['config'] || '{}') || {};
|
||||
|
||||
// @ts-ignore
|
||||
require.config({
|
||||
baseUrl: uriFromPath(configuration.appRoot) + '/out',
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
require([
|
||||
'vs/workbench/workbench.nodeless.main',
|
||||
'vs/nls!vs/workbench/workbench.nodeless.main',
|
||||
'vs/css!vs/workbench/workbench.nodeless.main'
|
||||
], function () {
|
||||
|
||||
// @ts-ignore
|
||||
require('vs/workbench/browser/nodeless.main').main().then(undefined, console.error);
|
||||
});
|
||||
});
|
||||
})();
|
||||
@@ -6,7 +6,7 @@
|
||||
import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor } from 'electron';
|
||||
import { IProcessEnvironment, isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||
import { WindowsManager } from 'vs/code/electron-main/windows';
|
||||
import { IWindowsService, OpenContext, ActiveWindowManager } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowsService, OpenContext, ActiveWindowManager, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { WindowsChannel } from 'vs/platform/windows/node/windowsIpc';
|
||||
import { WindowsService } from 'vs/platform/windows/electron-main/windowsService';
|
||||
import { ILifecycleService, LifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
|
||||
@@ -16,7 +16,6 @@ import { UpdateChannel } from 'vs/platform/update/node/updateIpc';
|
||||
import { Server as ElectronIPCServer } from 'vs/base/parts/ipc/electron-main/ipc.electron-main';
|
||||
import { Server, connect, Client } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { SharedProcess } from 'vs/code/electron-main/sharedProcess';
|
||||
import { Mutex } from 'windows-mutex';
|
||||
import { LaunchService, LaunchChannel, ILaunchService } from 'vs/platform/launch/electron-main/launchService';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
@@ -33,14 +32,14 @@ import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc
|
||||
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
|
||||
import { getDelayedChannel, StaticRouter } from 'vs/base/parts/ipc/node/ipc';
|
||||
import product from 'vs/platform/node/product';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import { ProxyAuthHandler } from 'vs/code/electron-main/auth';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';
|
||||
import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
|
||||
import { IHistoryMainService } from 'vs/platform/history/common/history';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { isUndefinedOrNull, withUndefinedAsNull } from 'vs/base/common/types';
|
||||
import { KeyboardLayoutMonitor } from 'vs/code/electron-main/keyboard';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { WorkspacesChannel } from 'vs/platform/workspaces/node/workspacesIpc';
|
||||
@@ -56,7 +55,7 @@ import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlListener';
|
||||
import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
|
||||
import { connectRemoteAgentManagement, RemoteAgentConnectionContext } from 'vs/platform/remote/node/remoteAgentConnection';
|
||||
import { connectRemoteAgentManagement } from 'vs/platform/remote/node/remoteAgentConnection';
|
||||
import { IMenubarService } from 'vs/platform/menubar/common/menubar';
|
||||
import { MenubarService } from 'vs/platform/menubar/electron-main/menubarService';
|
||||
import { MenubarChannel } from 'vs/platform/menubar/node/menubarIpc';
|
||||
@@ -64,8 +63,8 @@ import { hasArgs } from 'vs/platform/environment/node/argv';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu';
|
||||
import { storeBackgroundColor } from 'vs/code/electron-main/theme';
|
||||
import { nativeSep, join } from 'vs/base/common/paths';
|
||||
import { homedir } from 'os';
|
||||
import { join, sep } from 'vs/base/common/path';
|
||||
import { localize } from 'vs/nls';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from 'vs/platform/remote/node/remoteAgentFileSystemChannel';
|
||||
@@ -73,13 +72,13 @@ import { ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityReso
|
||||
import { SnapUpdateService } from 'vs/platform/update/electron-main/updateService.snap';
|
||||
import { IStorageMainService, StorageMainService } from 'vs/platform/storage/node/storageMainService';
|
||||
import { GlobalStorageDatabaseChannel } from 'vs/platform/storage/node/storageIpc';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService';
|
||||
import { IBackupMainService } from 'vs/platform/backup/common/backup';
|
||||
import { HistoryMainService } from 'vs/platform/history/electron-main/historyMainService';
|
||||
import { URLService } from 'vs/platform/url/common/urlService';
|
||||
import { WorkspacesMainService } from 'vs/platform/workspaces/electron-main/workspacesMainService';
|
||||
import { RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment';
|
||||
|
||||
export class CodeApplication extends Disposable {
|
||||
|
||||
@@ -93,8 +92,8 @@ export class CodeApplication extends Disposable {
|
||||
private sharedProcessClient: Promise<Client>;
|
||||
|
||||
constructor(
|
||||
private mainIpcServer: Server,
|
||||
private userEnv: IProcessEnvironment,
|
||||
private readonly mainIpcServer: Server,
|
||||
private readonly userEnv: IProcessEnvironment,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IEnvironmentService private readonly environmentService: IEnvironmentService,
|
||||
@@ -155,7 +154,7 @@ export class CodeApplication extends Disposable {
|
||||
const srcUri = URI.parse(source).fsPath.toLowerCase();
|
||||
const rootUri = URI.file(this.environmentService.appRoot).fsPath.toLowerCase();
|
||||
|
||||
return startsWith(srcUri, rootUri + nativeSep);
|
||||
return startsWith(srcUri, rootUri + sep);
|
||||
};
|
||||
|
||||
// Ensure defaults
|
||||
@@ -188,14 +187,14 @@ export class CodeApplication extends Disposable {
|
||||
});
|
||||
});
|
||||
|
||||
let macOpenFileURIs: URI[] = [];
|
||||
let macOpenFileURIs: IURIToOpen[] = [];
|
||||
let runningTimeout: any = null;
|
||||
app.on('open-file', (event: Event, path: string) => {
|
||||
this.logService.trace('App#open-file: ', path);
|
||||
event.preventDefault();
|
||||
|
||||
// Keep in array because more might come!
|
||||
macOpenFileURIs.push(URI.file(path));
|
||||
macOpenFileURIs.push({ uri: URI.file(path) });
|
||||
|
||||
// Clear previous handler if any
|
||||
if (runningTimeout !== null) {
|
||||
@@ -461,6 +460,7 @@ export class CodeApplication extends Disposable {
|
||||
|
||||
const appInstantiationService = this.instantiationService.createChild(services);
|
||||
|
||||
// Init services that require it
|
||||
return appInstantiationService.invokeFunction(accessor => Promise.all([
|
||||
this.initStorageService(accessor),
|
||||
this.initBackupService(accessor)
|
||||
@@ -473,35 +473,8 @@ export class CodeApplication extends Disposable {
|
||||
// Ensure to close storage on shutdown
|
||||
this.lifecycleService.onWillShutdown(e => e.join(storageMainService.close()));
|
||||
|
||||
// Initialize storage service
|
||||
return storageMainService.initialize().then(undefined, error => {
|
||||
errors.onUnexpectedError(error);
|
||||
this.logService.error(error);
|
||||
}).then(() => {
|
||||
return Promise.resolve();
|
||||
|
||||
// Apply global telemetry values as part of the initialization
|
||||
// These are global across all windows and thereby should be
|
||||
// written from the main process once.
|
||||
|
||||
const telemetryInstanceId = 'telemetry.instanceId';
|
||||
const instanceId = storageMainService.get(telemetryInstanceId, null);
|
||||
if (instanceId === null) {
|
||||
storageMainService.store(telemetryInstanceId, generateUuid());
|
||||
}
|
||||
|
||||
const telemetryFirstSessionDate = 'telemetry.firstSessionDate';
|
||||
const firstSessionDate = storageMainService.get(telemetryFirstSessionDate, null);
|
||||
if (firstSessionDate === null) {
|
||||
storageMainService.store(telemetryFirstSessionDate, new Date().toUTCString());
|
||||
}
|
||||
|
||||
const telemetryCurrentSessionDate = 'telemetry.currentSessionDate';
|
||||
const telemetryLastSessionDate = 'telemetry.lastSessionDate';
|
||||
const lastSessionDate = storageMainService.get(telemetryCurrentSessionDate, null); // previous session date was the "current" one at that time
|
||||
const currentSessionDate = new Date().toUTCString(); // current session date is "now"
|
||||
storageMainService.store(telemetryLastSessionDate, lastSessionDate);
|
||||
storageMainService.store(telemetryCurrentSessionDate, currentSessionDate);
|
||||
});
|
||||
}
|
||||
|
||||
private initBackupService(accessor: ServicesAccessor): Promise<void> {
|
||||
@@ -545,7 +518,7 @@ export class CodeApplication extends Disposable {
|
||||
this.electronIpcServer.registerChannel('url', urlChannel);
|
||||
|
||||
const storageMainService = accessor.get(IStorageMainService);
|
||||
const storageChannel = this._register(new GlobalStorageDatabaseChannel(storageMainService as StorageMainService));
|
||||
const storageChannel = this._register(new GlobalStorageDatabaseChannel(this.logService, storageMainService as StorageMainService));
|
||||
this.electronIpcServer.registerChannel('storage', storageChannel);
|
||||
|
||||
// Log level management
|
||||
@@ -584,13 +557,13 @@ export class CodeApplication extends Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
// Register the multiple URL handker
|
||||
// Register the multiple URL handler
|
||||
urlService.registerHandler(multiplexURLHandler);
|
||||
|
||||
// Watch Electron URLs and forward them to the UrlService
|
||||
const args = this.environmentService.args;
|
||||
const urls = args['open-url'] ? args._urls : [];
|
||||
const urlListener = new ElectronURLListener(urls, urlService, this.windowsMainService);
|
||||
const urlListener = new ElectronURLListener(urls || [], urlService, this.windowsMainService);
|
||||
this._register(urlListener);
|
||||
|
||||
this.windowsMainService.ready(this.userEnv);
|
||||
@@ -607,7 +580,7 @@ export class CodeApplication extends Disposable {
|
||||
}
|
||||
|
||||
if (macOpenFiles && macOpenFiles.length && !hasCliArgs && !hasFolderURIs && !hasFileURIs) {
|
||||
return this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, urisToOpen: macOpenFiles.map(file => URI.file(file)), initialStartup: true }); // mac: open-file event received on startup
|
||||
return this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, urisToOpen: macOpenFiles.map(file => ({ uri: URI.file(file) })), initialStartup: true }); // mac: open-file event received on startup
|
||||
}
|
||||
|
||||
return this.windowsMainService.open({ context, cli: args, forceNewWindow: args['new-window'] || (!hasCliArgs && args['unity-launch']), diffMode: args.diff, initialStartup: true }); // default: read paths from cli
|
||||
@@ -617,13 +590,12 @@ export class CodeApplication extends Disposable {
|
||||
const windowsMainService = accessor.get(IWindowsMainService);
|
||||
const historyMainService = accessor.get(IHistoryMainService);
|
||||
|
||||
let windowsMutex: Mutex | null = null;
|
||||
if (isWindows) {
|
||||
|
||||
// Setup Windows mutex
|
||||
try {
|
||||
const Mutex = (require.__$__nodeRequire('windows-mutex') as any).Mutex;
|
||||
windowsMutex = new Mutex(product.win32MutexName);
|
||||
const windowsMutex = new Mutex(product.win32MutexName);
|
||||
this._register(toDisposable(() => windowsMutex.release()));
|
||||
} catch (e) {
|
||||
if (!this.environmentService.isBuilt) {
|
||||
@@ -677,17 +649,17 @@ export class CodeApplication extends Disposable {
|
||||
const isBuilt = this.environmentService.isBuilt;
|
||||
|
||||
class ActiveConnection {
|
||||
private _authority: string;
|
||||
private _client: Promise<Client<RemoteAgentConnectionContext>>;
|
||||
private _disposeRunner: RunOnceScheduler;
|
||||
private readonly _authority: string;
|
||||
private readonly _client: Promise<Client<RemoteAgentConnectionContext>>;
|
||||
private readonly _disposeRunner: RunOnceScheduler;
|
||||
|
||||
constructor(authority: string, host: string, port: number) {
|
||||
this._authority = authority;
|
||||
this._client = connectRemoteAgentManagement(authority, host, port, `main`, isBuilt);
|
||||
this._disposeRunner = new RunOnceScheduler(() => this._dispose(), 5000);
|
||||
this._disposeRunner = new RunOnceScheduler(() => this.dispose(), 5000);
|
||||
}
|
||||
|
||||
private _dispose(): void {
|
||||
dispose(): void {
|
||||
this._disposeRunner.dispose();
|
||||
connectionPool.delete(this._authority);
|
||||
this._client.then((connection) => {
|
||||
@@ -695,7 +667,7 @@ export class CodeApplication extends Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
public getClient(): Promise<Client<RemoteAgentConnectionContext>> {
|
||||
getClient(): Promise<Client<RemoteAgentConnectionContext>> {
|
||||
this._disposeRunner.schedule();
|
||||
return this._client;
|
||||
}
|
||||
@@ -703,42 +675,49 @@ export class CodeApplication extends Disposable {
|
||||
|
||||
const resolvedAuthorities = new Map<string, ResolvedAuthority>();
|
||||
ipc.on('vscode:remoteAuthorityResolved', (event: any, data: ResolvedAuthority) => {
|
||||
this.logService.info('Received resolved authority', data.authority);
|
||||
resolvedAuthorities.set(data.authority, data);
|
||||
// Make sure to close and remove any existing connections
|
||||
if (connectionPool.has(data.authority)) {
|
||||
connectionPool.get(data.authority)!.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
const resolveAuthority = (authority: string): ResolvedAuthority | null => {
|
||||
this.logService.info('Resolving authority', authority);
|
||||
if (authority.indexOf('+') >= 0) {
|
||||
if (resolvedAuthorities.has(authority)) {
|
||||
return resolvedAuthorities.get(authority);
|
||||
return withUndefinedAsNull(resolvedAuthorities.get(authority));
|
||||
}
|
||||
this.logService.info('Didnot find resolved authority for', authority);
|
||||
return null;
|
||||
} else {
|
||||
const [host, strPort] = authority.split(':');
|
||||
const port = parseInt(strPort, 10);
|
||||
return { authority, host, port, syncExtensions: false };
|
||||
return { authority, host, port };
|
||||
}
|
||||
};
|
||||
|
||||
protocol.registerBufferProtocol(REMOTE_HOST_SCHEME, async (request, callback) => {
|
||||
if (request.method !== 'GET') {
|
||||
return callback(null);
|
||||
return callback(undefined);
|
||||
}
|
||||
const uri = URI.parse(request.url);
|
||||
|
||||
let activeConnection: ActiveConnection = null;
|
||||
let activeConnection: ActiveConnection | undefined;
|
||||
if (connectionPool.has(uri.authority)) {
|
||||
activeConnection = connectionPool.get(uri.authority);
|
||||
} else {
|
||||
let resolvedAuthority = resolveAuthority(uri.authority);
|
||||
const resolvedAuthority = resolveAuthority(uri.authority);
|
||||
if (!resolvedAuthority) {
|
||||
callback(null);
|
||||
callback(undefined);
|
||||
return;
|
||||
}
|
||||
activeConnection = new ActiveConnection(uri.authority, resolvedAuthority.host, resolvedAuthority.port);
|
||||
connectionPool.set(uri.authority, activeConnection);
|
||||
}
|
||||
try {
|
||||
const rawClient = await activeConnection.getClient();
|
||||
const rawClient = await activeConnection!.getClient();
|
||||
if (connectionPool.has(uri.authority)) { // not disposed in the meantime
|
||||
const channel = rawClient.getChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME);
|
||||
|
||||
@@ -746,11 +725,11 @@ export class CodeApplication extends Disposable {
|
||||
const fileContents = await channel.call<Uint8Array>('readFile', [uri]);
|
||||
callback(Buffer.from(fileContents));
|
||||
} else {
|
||||
callback(null);
|
||||
callback(undefined);
|
||||
}
|
||||
} catch (err) {
|
||||
errors.onUnexpectedError(err);
|
||||
callback(null);
|
||||
callback(undefined);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
import * as os from 'os';
|
||||
import * as cp from 'child_process';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { localize } from 'vs/nls';
|
||||
import product from 'vs/platform/node/product';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IRequestService } from 'vs/platform/request/node/request';
|
||||
import { IRequestContext } from 'vs/base/node/request';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
@@ -7,15 +7,16 @@ import 'vs/code/code.main';
|
||||
import { app, dialog } from 'electron';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { parseMainProcessArgv } from 'vs/platform/environment/node/argvHelper';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { parseMainProcessArgv, createWaitMarkerFile } from 'vs/platform/environment/node/argvHelper';
|
||||
import { addArg } from 'vs/platform/environment/node/argv';
|
||||
import { mkdirp } from 'vs/base/node/pfs';
|
||||
import { validatePaths } from 'vs/code/node/paths';
|
||||
import { LifecycleService, ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
|
||||
import { Server, serve, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { LaunchChannelClient } from 'vs/platform/launch/electron-main/launchService';
|
||||
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/node/instantiationService';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { ILogService, ConsoleLogMainService, MultiplexLogService, getLogLevel } from 'vs/platform/log/common/log';
|
||||
@@ -36,7 +37,6 @@ import { IDiagnosticsService, DiagnosticsService } from 'vs/platform/diagnostics
|
||||
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
|
||||
import { uploadLogs } from 'vs/code/electron-main/logUploader';
|
||||
import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
import { createWaitMarkerFile } from 'vs/code/node/wait';
|
||||
|
||||
class ExpectedError extends Error {
|
||||
readonly isExpected = true;
|
||||
@@ -114,7 +114,7 @@ function setupIPC(accessor: ServicesAccessor): Promise<Server> {
|
||||
client => {
|
||||
|
||||
// Tests from CLI require to be the only instance currently
|
||||
if (environmentService.extensionTestsPath && !environmentService.debugExtensionHost.break) {
|
||||
if (environmentService.extensionTestsLocationURI && !environmentService.debugExtensionHost.break) {
|
||||
const msg = 'Running extension tests from the command line is currently only supported if no other instance of Code is running.';
|
||||
logService.error(msg);
|
||||
client.dispose();
|
||||
@@ -158,7 +158,7 @@ function setupIPC(accessor: ServicesAccessor): Promise<Server> {
|
||||
logService.trace('Sending env to running instance...');
|
||||
|
||||
return allowSetForegroundWindow(service)
|
||||
.then(() => service.start(environmentService.args, process.env))
|
||||
.then(() => service.start(environmentService.args, process.env as platform.IProcessEnvironment))
|
||||
.then(() => client.dispose())
|
||||
.then(() => {
|
||||
|
||||
@@ -216,7 +216,7 @@ function handleStartupDataDirError(environmentService: IEnvironmentService, erro
|
||||
if (error.code === 'EACCES' || error.code === 'EPERM') {
|
||||
showStartupWarningDialog(
|
||||
localize('startupDataDirError', "Unable to write program user data."),
|
||||
localize('startupDataDirErrorDetail', "Please make sure the directory {0} is writeable.", environmentService.userDataPath)
|
||||
localize('startupDataDirErrorDetail', "Please make sure the directories {0} and {1} are writeable.", environmentService.userDataPath, environmentService.extensionsPath)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -316,14 +316,14 @@ function createServices(args: ParsedArgs, bufferLogService: BufferLogService): I
|
||||
function initServices(environmentService: IEnvironmentService, stateService: StateService): Promise<any> {
|
||||
|
||||
// Ensure paths for environment service exist
|
||||
const environmentServiceInitialization = Promise.all([
|
||||
const environmentServiceInitialization = Promise.all<boolean | undefined>([
|
||||
environmentService.extensionsPath,
|
||||
environmentService.nodeCachedDataDir,
|
||||
environmentService.logsPath,
|
||||
environmentService.globalStorageHome,
|
||||
environmentService.workspaceStorageHome,
|
||||
environmentService.backupHome
|
||||
].map(path => path && mkdirp(path)));
|
||||
].map((path): undefined | Promise<boolean> => path ? mkdirp(path) : undefined));
|
||||
|
||||
// State service
|
||||
const stateServiceInitialization = stateService.init();
|
||||
@@ -359,7 +359,7 @@ function main(): void {
|
||||
if (args.wait && !args.waitMarkerFilePath) {
|
||||
createWaitMarkerFile(args.verbose).then(waitMarkerFilePath => {
|
||||
if (waitMarkerFilePath) {
|
||||
process.argv.push('--waitMarkerFilePath', waitMarkerFilePath);
|
||||
addArg(process.argv, '--waitMarkerFilePath', waitMarkerFilePath);
|
||||
args.waitMarkerFilePath = waitMarkerFilePath;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as nls from 'vs/nls';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -13,7 +13,7 @@ import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { parseArgs } from 'vs/platform/environment/node/argv';
|
||||
import product from 'vs/platform/node/product';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IWindowSettings, MenuBarVisibility, IWindowConfiguration, ReadyState, IRunActionInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
@@ -24,8 +24,8 @@ import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import * as perf from 'vs/base/common/performance';
|
||||
import { resolveMarketplaceHeaders } from 'vs/platform/extensionManagement/node/extensionGalleryService';
|
||||
import { getBackgroundColor } from 'vs/code/electron-main/theme';
|
||||
import { IStorageMainService } from 'vs/platform/storage/node/storageMainService';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
export interface IWindowCreationOptions {
|
||||
state: IWindowState;
|
||||
@@ -70,14 +70,16 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
private currentMenuBarVisibility: MenuBarVisibility;
|
||||
private representedFilename: string;
|
||||
|
||||
private whenReadyCallbacks: { (window: ICodeWindow): void }[];
|
||||
private readonly whenReadyCallbacks: { (window: ICodeWindow): void }[];
|
||||
|
||||
private currentConfig: IWindowConfiguration;
|
||||
private pendingLoadConfig: IWindowConfiguration;
|
||||
private pendingLoadConfig?: IWindowConfiguration;
|
||||
|
||||
private marketplaceHeadersPromise: Promise<object>;
|
||||
|
||||
private touchBarGroups: Electron.TouchBarSegmentedControl[];
|
||||
private readonly touchBarGroups: Electron.TouchBarSegmentedControl[];
|
||||
|
||||
private nodeless: boolean;
|
||||
|
||||
constructor(
|
||||
config: IWindowCreationOptions,
|
||||
@@ -87,7 +89,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
@IStateService private readonly stateService: IStateService,
|
||||
@IWorkspacesMainService private readonly workspacesMainService: IWorkspacesMainService,
|
||||
@IBackupMainService private readonly backupMainService: IBackupMainService,
|
||||
@IStorageMainService private readonly storageMainService: IStorageMainService
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -96,6 +97,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
this._readyState = ReadyState.NONE;
|
||||
this.whenReadyCallbacks = [];
|
||||
|
||||
this.nodeless = !!(environmentService.args.nodeless && !environmentService.isBuilt);
|
||||
|
||||
// create browser window
|
||||
this.createBrowserWindow(config);
|
||||
|
||||
@@ -125,7 +128,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
height: this.windowState.height,
|
||||
x: this.windowState.x,
|
||||
y: this.windowState.y,
|
||||
backgroundColor: getBackgroundColor(this.stateService),
|
||||
backgroundColor: this.nodeless ? undefined : getBackgroundColor(this.stateService),
|
||||
minWidth: CodeWindow.MIN_WIDTH,
|
||||
minHeight: CodeWindow.MIN_HEIGHT,
|
||||
show: !isFullscreenOrMaximized,
|
||||
@@ -135,10 +138,14 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// want to enforce that Code stays in the foreground. This triggers a disable_hidden_
|
||||
// flag that Electron provides via patch:
|
||||
// https://github.com/electron/libchromiumcontent/blob/master/patches/common/chromium/disable_hidden.patch
|
||||
'backgroundThrottling': false
|
||||
backgroundThrottling: false
|
||||
}
|
||||
};
|
||||
|
||||
if (this.nodeless) {
|
||||
options.webPreferences!.nodeIntegration = false; // simulate Electron 5 behaviour
|
||||
}
|
||||
|
||||
if (isLinux) {
|
||||
options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s)
|
||||
}
|
||||
@@ -193,6 +200,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.nodeless) {
|
||||
this._win.webContents.toggleDevTools();
|
||||
}
|
||||
|
||||
this._lastFocusTime = Date.now(); // since we show directly, we need to set the last focus time too
|
||||
}
|
||||
|
||||
@@ -208,7 +219,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
return !!this.config.extensionTestsPath;
|
||||
}
|
||||
|
||||
get extensionDevelopmentPath(): string {
|
||||
get extensionDevelopmentPath(): string | undefined {
|
||||
return this.config.extensionDevelopmentPath;
|
||||
}
|
||||
|
||||
@@ -256,19 +267,19 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
return this._lastFocusTime;
|
||||
}
|
||||
|
||||
get backupPath(): string {
|
||||
get backupPath(): string | undefined {
|
||||
return this.currentConfig ? this.currentConfig.backupPath : undefined;
|
||||
}
|
||||
|
||||
get openedWorkspace(): IWorkspaceIdentifier {
|
||||
get openedWorkspace(): IWorkspaceIdentifier | undefined {
|
||||
return this.currentConfig ? this.currentConfig.workspace : undefined;
|
||||
}
|
||||
|
||||
get openedFolderUri(): URI {
|
||||
get openedFolderUri(): URI | undefined {
|
||||
return this.currentConfig ? this.currentConfig.folderUri : undefined;
|
||||
}
|
||||
|
||||
get remoteAuthority(): string {
|
||||
get remoteAuthority(): string | undefined {
|
||||
return this.currentConfig ? this.currentConfig.remoteAuthority : undefined;
|
||||
}
|
||||
|
||||
@@ -305,7 +316,11 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
const urls = ['https://marketplace.visualstudio.com/*', 'https://*.vsassets.io/*'];
|
||||
this._win.webContents.session.webRequest.onBeforeSendHeaders({ urls }, (details: any, cb: any) => {
|
||||
this.marketplaceHeadersPromise.then(headers => {
|
||||
cb({ cancel: false, requestHeaders: objects.assign(details.requestHeaders, headers) });
|
||||
const requestHeaders = objects.assign(details.requestHeaders, headers);
|
||||
if (!this.configurationService.getValue('extensions.disableExperimentalAzureSearch')) {
|
||||
requestHeaders['Cookie'] = `${requestHeaders['Cookie'] ? requestHeaders['Cookie'] + ';' : ''}EnableExternalSearchForVSCode=true`;
|
||||
}
|
||||
cb({ cancel: false, requestHeaders });
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -313,7 +328,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
private registerListeners(): void {
|
||||
|
||||
// Prevent loading of svgs
|
||||
this._win.webContents.session.webRequest.onBeforeRequest(null, (details, callback) => {
|
||||
this._win.webContents.session.webRequest.onBeforeRequest(null!, (details, callback) => {
|
||||
if (details.url.indexOf('.svg') > 0) {
|
||||
const uri = URI.parse(details.url);
|
||||
if (uri && !uri.scheme.match(/file/i) && (uri.path as any).endsWith('.svg')) {
|
||||
@@ -324,7 +339,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
return callback({});
|
||||
});
|
||||
|
||||
this._win.webContents.session.webRequest.onHeadersReceived(null, (details: any, callback: any) => {
|
||||
this._win.webContents.session.webRequest.onHeadersReceived(null!, (details: any, callback: any) => {
|
||||
const contentType: string[] = (details.responseHeaders['content-type'] || details.responseHeaders['Content-Type']) as any;
|
||||
if (contentType && Array.isArray(contentType) && contentType.some(x => x.toLowerCase().indexOf('image/svg') >= 0)) {
|
||||
return callback({ cancel: true });
|
||||
@@ -341,7 +356,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
if (this.pendingLoadConfig) {
|
||||
this.currentConfig = this.pendingLoadConfig;
|
||||
|
||||
this.pendingLoadConfig = null;
|
||||
this.pendingLoadConfig = undefined;
|
||||
}
|
||||
|
||||
// To prevent flashing, we set the window visible after the page has finished to load but before Code is loaded
|
||||
@@ -392,7 +407,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
}
|
||||
|
||||
// Window (Un)Maximize
|
||||
this._win.on('maximize', e => {
|
||||
this._win.on('maximize', (e: Event) => {
|
||||
if (this.currentConfig) {
|
||||
this.currentConfig.maximized = true;
|
||||
}
|
||||
@@ -400,7 +415,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
app.emit('browser-window-maximize', e, this._win);
|
||||
});
|
||||
|
||||
this._win.on('unmaximize', e => {
|
||||
this._win.on('unmaximize', (e: Event) => {
|
||||
if (this.currentConfig) {
|
||||
this.currentConfig.maximized = false;
|
||||
}
|
||||
@@ -522,7 +537,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
|
||||
// Make window visible if it did not open in N seconds because this indicates an error
|
||||
// Only do this when running out of sources and not when running tests
|
||||
if (!this.environmentService.isBuilt && !this.environmentService.extensionTestsPath) {
|
||||
if (!this.environmentService.isBuilt && !this.environmentService.extensionTestsLocationURI) {
|
||||
this.showTimeoutHandle = setTimeout(() => {
|
||||
if (this._win && !this._win.isVisible() && !this._win.isMinimized()) {
|
||||
this._win.show();
|
||||
@@ -548,8 +563,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// in extension development mode. These options are all development related.
|
||||
if (this.isExtensionDevelopmentHost && cli) {
|
||||
configuration.verbose = cli.verbose;
|
||||
configuration.debugPluginHost = cli.debugPluginHost;
|
||||
configuration.debugBrkPluginHost = cli.debugBrkPluginHost;
|
||||
configuration['inspect-extensions'] = cli['inspect-extensions'];
|
||||
configuration['inspect-brk-extensions'] = cli['inspect-brk-extensions'];
|
||||
configuration.debugId = cli.debugId;
|
||||
configuration['extensions-dir'] = cli['extensions-dir'];
|
||||
}
|
||||
@@ -593,7 +608,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
windowConfiguration.perfEntries = perf.exportEntries();
|
||||
|
||||
// Parts splash
|
||||
windowConfiguration.partsSplashData = this.storageMainService.get('parts-splash-data', undefined);
|
||||
windowConfiguration.partsSplashPath = path.join(this.environmentService.userDataPath, 'rapid_render.json');
|
||||
|
||||
// Config (combination of process.argv and window configuration)
|
||||
const environment = parseArgs(process.argv);
|
||||
@@ -623,6 +638,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
}
|
||||
|
||||
private doGetUrl(config: object): string {
|
||||
if (this.nodeless) {
|
||||
return `${require.toUrl('vs/code/electron-browser/workbench/workbench.nodeless.html')}?config=${encodeURIComponent(JSON.stringify(config))}`;
|
||||
}
|
||||
|
||||
return `${require.toUrl('vs/code/electron-browser/workbench/workbench.html')}?config=${encodeURIComponent(JSON.stringify(config))}`;
|
||||
}
|
||||
|
||||
@@ -688,7 +707,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
private restoreWindowState(state?: IWindowState): IWindowState {
|
||||
if (state) {
|
||||
try {
|
||||
state = this.validateWindowState(state);
|
||||
state = withNullAsUndefined(this.validateWindowState(state));
|
||||
} catch (err) {
|
||||
this.logService.warn(`Unexpected error validating window state: ${err}\n${err.stack}`); // somehow display API can be picky about the state to validate
|
||||
}
|
||||
@@ -706,7 +725,11 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ([state.x, state.y, state.width, state.height].some(n => typeof n !== 'number')) {
|
||||
if (typeof state.x !== 'number'
|
||||
|| typeof state.y !== 'number'
|
||||
|| typeof state.width !== 'number'
|
||||
|| typeof state.height !== 'number'
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1045,6 +1068,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
clearTimeout(this.showTimeoutHandle);
|
||||
}
|
||||
|
||||
this._win = null; // Important to dereference the window object to allow for GC
|
||||
this._win = null!; // Important to dereference the window object to allow for GC
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
86
src/vs/code/electron-main/windowsStateStorage.ts
Normal file
86
src/vs/code/electron-main/windowsStateStorage.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IWindowState as IWindowUIState } from 'vs/platform/windows/electron-main/windows';
|
||||
import { IWindowState, IWindowsState } from 'vs/code/electron-main/windows';
|
||||
|
||||
export type WindowsStateStorageData = object;
|
||||
|
||||
interface ISerializedWindowsState {
|
||||
lastActiveWindow?: ISerializedWindowState;
|
||||
lastPluginDevelopmentHostWindow?: ISerializedWindowState;
|
||||
openedWindows: ISerializedWindowState[];
|
||||
}
|
||||
|
||||
interface ISerializedWindowState {
|
||||
workspaceIdentifier?: { id: string; configURIPath: string };
|
||||
folder?: string;
|
||||
backupPath?: string;
|
||||
remoteAuthority?: string;
|
||||
uiState: IWindowUIState;
|
||||
|
||||
// deprecated
|
||||
folderUri?: UriComponents;
|
||||
folderPath?: string;
|
||||
workspace?: { id: string; configPath: string };
|
||||
}
|
||||
|
||||
export function restoreWindowsState(data: WindowsStateStorageData | undefined): IWindowsState {
|
||||
const result: IWindowsState = { openedWindows: [] };
|
||||
const windowsState = data as ISerializedWindowsState || { openedWindows: [] };
|
||||
|
||||
if (windowsState.lastActiveWindow) {
|
||||
result.lastActiveWindow = restoreWindowState(windowsState.lastActiveWindow);
|
||||
}
|
||||
if (windowsState.lastPluginDevelopmentHostWindow) {
|
||||
result.lastPluginDevelopmentHostWindow = restoreWindowState(windowsState.lastPluginDevelopmentHostWindow);
|
||||
}
|
||||
if (Array.isArray(windowsState.openedWindows)) {
|
||||
result.openedWindows = windowsState.openedWindows.map(windowState => restoreWindowState(windowState));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function restoreWindowState(windowState: ISerializedWindowState): IWindowState {
|
||||
const result: IWindowState = { uiState: windowState.uiState };
|
||||
if (windowState.backupPath) {
|
||||
result.backupPath = windowState.backupPath;
|
||||
}
|
||||
if (windowState.remoteAuthority) {
|
||||
result.remoteAuthority = windowState.remoteAuthority;
|
||||
}
|
||||
if (windowState.folder) {
|
||||
result.folderUri = URI.parse(windowState.folder);
|
||||
} else if (windowState.folderUri) {
|
||||
result.folderUri = URI.revive(windowState.folderUri);
|
||||
} else if (windowState.folderPath) {
|
||||
result.folderUri = URI.file(windowState.folderPath);
|
||||
}
|
||||
if (windowState.workspaceIdentifier) {
|
||||
result.workspace = { id: windowState.workspaceIdentifier.id, configPath: URI.parse(windowState.workspaceIdentifier.configURIPath) };
|
||||
} else if (windowState.workspace) {
|
||||
result.workspace = { id: windowState.workspace.id, configPath: URI.file(windowState.workspace.configPath) };
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function getWindowsStateStoreData(windowsState: IWindowsState): WindowsStateStorageData {
|
||||
return {
|
||||
lastActiveWindow: windowsState.lastActiveWindow && serializeWindowState(windowsState.lastActiveWindow),
|
||||
lastPluginDevelopmentHostWindow: windowsState.lastPluginDevelopmentHostWindow && serializeWindowState(windowsState.lastPluginDevelopmentHostWindow),
|
||||
openedWindows: windowsState.openedWindows.map(ws => serializeWindowState(ws))
|
||||
};
|
||||
}
|
||||
|
||||
function serializeWindowState(windowState: IWindowState): ISerializedWindowState {
|
||||
return {
|
||||
workspaceIdentifier: windowState.workspace && { id: windowState.workspace.id, configURIPath: windowState.workspace.configPath.toString() },
|
||||
folder: windowState.folderUri && windowState.folderUri.toString(),
|
||||
backupPath: windowState.backupPath,
|
||||
remoteAuthority: windowState.remoteAuthority,
|
||||
uiState: windowState.uiState
|
||||
};
|
||||
}
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
import { spawn, ChildProcess } from 'child_process';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { buildHelpMessage, buildVersionMessage } from 'vs/platform/environment/node/argv';
|
||||
import { buildHelpMessage, buildVersionMessage, addArg } from 'vs/platform/environment/node/argv';
|
||||
import { parseCLIProcessArgv, createWaitMarkerFile } from 'vs/platform/environment/node/argvHelper';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import product from 'vs/platform/node/product';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import * as paths from 'path';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import * as paths from 'vs/base/common/path';
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import { whenDeleted } from 'vs/base/node/pfs';
|
||||
@@ -19,8 +20,6 @@ import * as iconv from 'iconv-lite';
|
||||
import { writeFileAndFlushSync } from 'vs/base/node/extfs';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { ProfilingSession, Target } from 'v8-inspect-profiler';
|
||||
import { createWaitMarkerFile } from 'vs/code/node/wait';
|
||||
import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
|
||||
|
||||
function shouldSpawnCliProcess(argv: ParsedArgs): boolean {
|
||||
return !!argv['install-source']
|
||||
@@ -180,11 +179,11 @@ export async function main(argv: string[]): Promise<any> {
|
||||
});
|
||||
|
||||
// Make sure to open tmp file
|
||||
argv.push(stdinFilePath);
|
||||
addArg(argv, stdinFilePath);
|
||||
|
||||
// Enable --wait to get all data and ignore adding this to history
|
||||
argv.push('--wait');
|
||||
argv.push('--skip-add-to-recently-opened');
|
||||
addArg(argv, '--wait');
|
||||
addArg(argv, '--skip-add-to-recently-opened');
|
||||
args.wait = true;
|
||||
}
|
||||
|
||||
@@ -232,7 +231,7 @@ export async function main(argv: string[]): Promise<any> {
|
||||
if (args.wait) {
|
||||
waitMarkerFilePath = await createWaitMarkerFile(verbose);
|
||||
if (waitMarkerFilePath) {
|
||||
argv.push('--waitMarkerFilePath', waitMarkerFilePath);
|
||||
addArg(argv, '--waitMarkerFilePath', waitMarkerFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,11 +251,11 @@ export async function main(argv: string[]): Promise<any> {
|
||||
|
||||
const filenamePrefix = paths.join(os.homedir(), 'prof-' + Math.random().toString(16).slice(-4));
|
||||
|
||||
argv.push(`--inspect-brk=${portMain}`);
|
||||
argv.push(`--remote-debugging-port=${portRenderer}`);
|
||||
argv.push(`--inspect-brk-extensions=${portExthost}`);
|
||||
argv.push(`--prof-startup-prefix`, filenamePrefix);
|
||||
argv.push(`--no-cached-data`);
|
||||
addArg(argv, `--inspect-brk=${portMain}`);
|
||||
addArg(argv, `--remote-debugging-port=${portRenderer}`);
|
||||
addArg(argv, `--inspect-brk-extensions=${portExthost}`);
|
||||
addArg(argv, `--prof-startup-prefix`, filenamePrefix);
|
||||
addArg(argv, `--no-cached-data`);
|
||||
|
||||
fs.writeFileSync(filenamePrefix, argv.slice(-6).join('|'));
|
||||
|
||||
@@ -341,7 +340,7 @@ export async function main(argv: string[]): Promise<any> {
|
||||
if (args['js-flags']) {
|
||||
const match = /max_old_space_size=(\d+)/g.exec(args['js-flags']);
|
||||
if (match && !args['max-memory']) {
|
||||
argv.push(`--max-memory=${match[1]}`);
|
||||
addArg(argv, `--max-memory=${match[1]}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,19 +4,18 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import product from 'vs/platform/node/product';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import * as path from 'path';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as semver from 'semver';
|
||||
|
||||
import { sequence } from 'vs/base/common/async';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { IExtensionManagementService, IExtensionGalleryService, IGalleryExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService, IExtensionGalleryService, IGalleryExtension, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
import { ExtensionGalleryService } from 'vs/platform/extensionManagement/node/extensionGalleryService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -38,7 +37,10 @@ import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { areSameExtensions, adoptToGalleryExtensionId, getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { getManifest } from 'vs/platform/extensionManagement/node/extensionManagementUtil';
|
||||
import { IExtensionManifest, ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtensionManifest, ExtensionType, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { isUIExtension } from 'vs/platform/extensions/node/extensionsUtil';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
|
||||
|
||||
const notFound = (id: string) => localize('notFound', "Extension '{0}' not found.", id);
|
||||
const notInstalled = (id: string) => localize('notInstalled', "Extension '{0}' is not installed.", id);
|
||||
@@ -66,7 +68,10 @@ export function getIdAndVersion(id: string): [string, string | undefined] {
|
||||
export class Main {
|
||||
|
||||
constructor(
|
||||
private readonly remote: boolean,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IEnvironmentService private readonly environmentService: IEnvironmentService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
||||
@IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService
|
||||
) { }
|
||||
@@ -100,38 +105,50 @@ export class Main {
|
||||
}
|
||||
|
||||
private async installExtensions(extensions: string[], force: boolean): Promise<void> {
|
||||
let failed: string[] = [];
|
||||
const failed: string[] = [];
|
||||
const installedExtensionsManifests: IExtensionManifest[] = [];
|
||||
for (const extension of extensions) {
|
||||
try {
|
||||
await this.installExtension(extension, force);
|
||||
const manifest = await this.installExtension(extension, force);
|
||||
if (manifest) {
|
||||
installedExtensionsManifests.push(manifest);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err.message || err.stack || err);
|
||||
failed.push(extension);
|
||||
}
|
||||
}
|
||||
if (installedExtensionsManifests.some(manifest => isLanguagePackExtension(manifest))) {
|
||||
await this.updateLocalizationsCache();
|
||||
}
|
||||
return failed.length ? Promise.reject(localize('installation failed', "Failed Installing Extensions: {0}", failed.join(', '))) : Promise.resolve();
|
||||
}
|
||||
|
||||
private installExtension(extension: string, force: boolean): Promise<any> {
|
||||
private async installExtension(extension: string, force: boolean): Promise<IExtensionManifest | null> {
|
||||
if (/\.vsix$/i.test(extension)) {
|
||||
extension = path.isAbsolute(extension) ? extension : path.join(process.cwd(), extension);
|
||||
|
||||
return this.validate(extension, force)
|
||||
.then(valid => {
|
||||
if (valid) {
|
||||
return this.extensionManagementService.install(URI.file(extension)).then(() => {
|
||||
console.log(localize('successVsixInstall', "Extension '{0}' was successfully installed!", getBaseLabel(extension)));
|
||||
}, error => {
|
||||
if (isPromiseCanceledError(error)) {
|
||||
console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", getBaseLabel(extension)));
|
||||
return null;
|
||||
} else {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
});
|
||||
const manifest = await getManifest(extension);
|
||||
if (this.remote && (!isLanguagePackExtension(manifest) && isUIExtension(manifest, [], this.configurationService))) {
|
||||
console.log(localize('notSupportedUIExtension', "Can't install extension {0} since UI Extensions are not supported", getBaseLabel(extension)));
|
||||
return null;
|
||||
}
|
||||
const valid = await this.validate(manifest, force);
|
||||
|
||||
if (valid) {
|
||||
return this.extensionManagementService.install(URI.file(extension)).then(id => {
|
||||
console.log(localize('successVsixInstall', "Extension '{0}' was successfully installed!", getBaseLabel(extension)));
|
||||
return manifest;
|
||||
}, error => {
|
||||
if (isPromiseCanceledError(error)) {
|
||||
console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", getBaseLabel(extension)));
|
||||
return null;
|
||||
} else {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const [id, version] = getIdAndVersion(extension);
|
||||
@@ -148,38 +165,37 @@ export class Main {
|
||||
}
|
||||
return Promise.reject(err);
|
||||
})
|
||||
.then(extension => {
|
||||
.then(async extension => {
|
||||
if (!extension) {
|
||||
return Promise.reject(new Error(`${notFound(version ? `${id}@${version}` : id)}\n${useId}`));
|
||||
}
|
||||
|
||||
const manifest = await this.extensionGalleryService.getManifest(extension, CancellationToken.None);
|
||||
if (this.remote && manifest && (!isLanguagePackExtension(manifest) && isUIExtension(manifest, [], this.configurationService))) {
|
||||
console.log(localize('notSupportedUIExtension', "Can't install extension {0} since UI Extensions are not supported", extension.identifier.id));
|
||||
return null;
|
||||
}
|
||||
|
||||
const [installedExtension] = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
||||
if (installedExtension) {
|
||||
if (extension.version !== installedExtension.manifest.version) {
|
||||
if (version || force) {
|
||||
console.log(localize('updateMessage', "Updating the Extension '{0}' to the version {1}", id, extension.version));
|
||||
return this.installFromGallery(id, extension);
|
||||
} else {
|
||||
console.log(localize('forceUpdate', "Extension '{0}' v{1} is already installed, but a newer version {2} is available in the marketplace. Use '--force' option to update to newer version.", id, installedExtension.manifest.version, extension.version));
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
} else {
|
||||
if (extension.version === installedExtension.manifest.version) {
|
||||
console.log(localize('alreadyInstalled', "Extension '{0}' is already installed.", version ? `${id}@${version}` : id));
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
if (!version && !force) {
|
||||
console.log(localize('forceUpdate', "Extension '{0}' v{1} is already installed, but a newer version {2} is available in the marketplace. Use '--force' option to update to newer version.", id, installedExtension.manifest.version, extension.version));
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
console.log(localize('updateMessage', "Updating the Extension '{0}' to the version {1}", id, extension.version));
|
||||
} else {
|
||||
console.log(localize('foundExtension', "Found '{0}' in the marketplace.", id));
|
||||
return this.installFromGallery(id, extension);
|
||||
}
|
||||
|
||||
await this.installFromGallery(id, extension);
|
||||
return manifest;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async validate(vsix: string, force: boolean): Promise<boolean> {
|
||||
const manifest = await getManifest(vsix);
|
||||
|
||||
private async validate(manifest: IExtensionManifest, force: boolean): Promise<boolean> {
|
||||
if (!manifest) {
|
||||
throw new Error('Invalid vsix');
|
||||
}
|
||||
@@ -211,7 +227,7 @@ export class Main {
|
||||
}
|
||||
}
|
||||
|
||||
private uninstallExtension(extensions: string[]): Promise<any> {
|
||||
private async uninstallExtension(extensions: string[]): Promise<any> {
|
||||
async function getExtensionId(extensionDescription: string): Promise<string> {
|
||||
if (!/\.vsix$/i.test(extensionDescription)) {
|
||||
return extensionDescription;
|
||||
@@ -222,22 +238,29 @@ export class Main {
|
||||
return getId(manifest);
|
||||
}
|
||||
|
||||
return sequence(extensions.map(extension => () => {
|
||||
return getExtensionId(extension).then(id => {
|
||||
return this.extensionManagementService.getInstalled(ExtensionType.User).then(installed => {
|
||||
const [extension] = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
||||
const uninstalledExtensions: ILocalExtension[] = [];
|
||||
for (const extension of extensions) {
|
||||
const id = await getExtensionId(extension);
|
||||
const installed = await this.extensionManagementService.getInstalled(ExtensionType.User);
|
||||
const [extensionToUninstall] = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
||||
if (!extensionToUninstall) {
|
||||
return Promise.reject(new Error(`${notInstalled(id)}\n${useId}`));
|
||||
}
|
||||
console.log(localize('uninstalling', "Uninstalling {0}...", id));
|
||||
await this.extensionManagementService.uninstall(extensionToUninstall, true);
|
||||
uninstalledExtensions.push(extensionToUninstall);
|
||||
console.log(localize('successUninstall', "Extension '{0}' was successfully uninstalled!", id));
|
||||
}
|
||||
|
||||
if (!extension) {
|
||||
return Promise.reject(new Error(`${notInstalled(id)}\n${useId}`));
|
||||
}
|
||||
if (uninstalledExtensions.some(e => isLanguagePackExtension(e.manifest))) {
|
||||
await this.updateLocalizationsCache();
|
||||
}
|
||||
}
|
||||
|
||||
console.log(localize('uninstalling', "Uninstalling {0}...", id));
|
||||
|
||||
return this.extensionManagementService.uninstall(extension, true)
|
||||
.then(() => console.log(localize('successUninstall', "Extension '{0}' was successfully uninstalled!", id)));
|
||||
});
|
||||
});
|
||||
}));
|
||||
private async updateLocalizationsCache(): Promise<void> {
|
||||
const localizationService = this.instantiationService.createInstance(LocalizationsService);
|
||||
await localizationService.update();
|
||||
localizationService.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +313,7 @@ export function main(argv: ParsedArgs): Promise<void> {
|
||||
}
|
||||
|
||||
const instantiationService2 = instantiationService.createChild(services);
|
||||
const main = instantiationService2.createInstance(Main);
|
||||
const main = instantiationService2.createInstance(Main, false);
|
||||
|
||||
return main.run(argv).then(() => {
|
||||
// Dispose the AI adapter so that remaining data gets flushed.
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
@@ -48,7 +48,7 @@ function doValidatePaths(args: string[], gotoLineMode?: boolean): string[] {
|
||||
const sanitizedFilePath = sanitizeFilePath(pathCandidate, cwd);
|
||||
|
||||
const basename = path.basename(sanitizedFilePath);
|
||||
if (basename /* can be empty if code is opened on root */ && !paths.isValidBasename(basename)) {
|
||||
if (basename /* can be empty if code is opened on root */ && !extpath.isValidBasename(basename)) {
|
||||
return null; // do not allow invalid file names
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
|
||||
function getUnixShellEnvironment(): Promise<typeof process.env> {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const promise = new Promise<typeof process.env>((resolve, reject) => {
|
||||
const runAsNode = process.env['ELECTRON_RUN_AS_NODE'];
|
||||
const noAttach = process.env['ELECTRON_NO_ATTACH_CONSOLE'];
|
||||
const mark = generateUuid().replace(/-/g, '').substr(0, 12);
|
||||
@@ -66,7 +66,7 @@ function getUnixShellEnvironment(): Promise<typeof process.env> {
|
||||
});
|
||||
|
||||
// swallow errors
|
||||
return promise.then(undefined, () => ({}));
|
||||
return promise.catch(() => ({}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import { writeFile } from 'vs/base/node/pfs';
|
||||
|
||||
export function createWaitMarkerFile(verbose?: boolean): Promise<string> {
|
||||
const randomWaitMarkerPath = join(tmpdir(), Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10));
|
||||
|
||||
return writeFile(randomWaitMarkerPath, '').then(() => {
|
||||
if (verbose) {
|
||||
console.log(`Marker file for --wait created: ${randomWaitMarkerPath}`);
|
||||
}
|
||||
|
||||
return randomWaitMarkerPath;
|
||||
}, error => {
|
||||
if (verbose) {
|
||||
console.error(`Failed to create marker file for --wait: ${error}`);
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { OpenContext } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceIdentifier, IResolvedWorkspace, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -21,32 +21,41 @@ export interface ISimpleWindow {
|
||||
export interface IBestWindowOrFolderOptions<W extends ISimpleWindow> {
|
||||
windows: W[];
|
||||
newWindow: boolean;
|
||||
reuseWindow: boolean;
|
||||
context: OpenContext;
|
||||
fileUri?: URI;
|
||||
userHome?: string;
|
||||
codeSettingsFolder?: string;
|
||||
workspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace | null;
|
||||
localWorkspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace | null;
|
||||
}
|
||||
|
||||
export function findBestWindowOrFolderForFile<W extends ISimpleWindow>({ windows, newWindow, reuseWindow, context, fileUri, workspaceResolver }: IBestWindowOrFolderOptions<W>): W | null {
|
||||
export function findBestWindowOrFolderForFile<W extends ISimpleWindow>({ windows, newWindow, context, fileUri, localWorkspaceResolver: workspaceResolver }: IBestWindowOrFolderOptions<W>): W | undefined {
|
||||
if (!newWindow && fileUri && (context === OpenContext.DESKTOP || context === OpenContext.CLI || context === OpenContext.DOCK)) {
|
||||
const windowOnFilePath = findWindowOnFilePath(windows, fileUri, workspaceResolver);
|
||||
if (windowOnFilePath) {
|
||||
return windowOnFilePath;
|
||||
}
|
||||
}
|
||||
return !newWindow ? getLastActiveWindow(windows) : null;
|
||||
return !newWindow ? getLastActiveWindow(windows) : undefined;
|
||||
}
|
||||
|
||||
function findWindowOnFilePath<W extends ISimpleWindow>(windows: W[], fileUri: URI, workspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace | null): W | null {
|
||||
function findWindowOnFilePath<W extends ISimpleWindow>(windows: W[], fileUri: URI, localWorkspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace | null): W | null {
|
||||
|
||||
// First check for windows with workspaces that have a parent folder of the provided path opened
|
||||
const workspaceWindows = windows.filter(window => !!window.openedWorkspace);
|
||||
for (const window of workspaceWindows) {
|
||||
const resolvedWorkspace = workspaceResolver(window.openedWorkspace!);
|
||||
if (resolvedWorkspace && resolvedWorkspace.folders.some(folder => isEqualOrParent(fileUri, folder.uri))) {
|
||||
return window;
|
||||
for (const window of windows) {
|
||||
const workspace = window.openedWorkspace;
|
||||
if (workspace) {
|
||||
const resolvedWorkspace = localWorkspaceResolver(workspace);
|
||||
if (resolvedWorkspace) {
|
||||
// workspace could be resolved: It's in the local file system
|
||||
if (resolvedWorkspace.folders.some(folder => isEqualOrParent(fileUri, folder.uri))) {
|
||||
return window;
|
||||
}
|
||||
} else {
|
||||
// use the config path instead
|
||||
if (isEqualOrParent(fileUri, workspace.configPath)) {
|
||||
return window;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +68,7 @@ function findWindowOnFilePath<W extends ISimpleWindow>(windows: W[], fileUri: UR
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getLastActiveWindow<W extends ISimpleWindow>(windows: W[]): W {
|
||||
export function getLastActiveWindow<W extends ISimpleWindow>(windows: W[]): W | undefined {
|
||||
const lastFocusedDate = Math.max.apply(Math, windows.map(window => window.lastFocusTime));
|
||||
|
||||
return windows.filter(window => window.lastFocusTime === lastFocusedDate)[0];
|
||||
@@ -89,20 +98,20 @@ export function findWindowOnWorkspace<W extends ISimpleWindow>(windows: W[], wor
|
||||
export function findWindowOnExtensionDevelopmentPath<W extends ISimpleWindow>(windows: W[], extensionDevelopmentPath: string): W | null {
|
||||
for (const window of windows) {
|
||||
// match on extension development path. The path can be a path or uri string, using paths.isEqual is not 100% correct but good enough
|
||||
if (window.extensionDevelopmentPath && paths.isEqual(window.extensionDevelopmentPath, extensionDevelopmentPath, !platform.isLinux /* ignorecase */)) {
|
||||
if (window.extensionDevelopmentPath && extpath.isEqual(window.extensionDevelopmentPath, extensionDevelopmentPath, !platform.isLinux /* ignorecase */)) {
|
||||
return window;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function findWindowOnWorkspaceOrFolderUri<W extends ISimpleWindow>(windows: W[], uri: URI): W | null {
|
||||
export function findWindowOnWorkspaceOrFolderUri<W extends ISimpleWindow>(windows: W[], uri: URI | undefined): W | null {
|
||||
if (!uri) {
|
||||
return null;
|
||||
}
|
||||
for (const window of windows) {
|
||||
// check for workspace config path
|
||||
if (window.openedWorkspace && isEqual(URI.file(window.openedWorkspace.configPath), uri, !platform.isLinux /* ignorecase */)) {
|
||||
if (window.openedWorkspace && isEqual(window.openedWorkspace.configPath, uri)) {
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
291
src/vs/code/test/electron-main/windowsStateStorage.test.ts
Normal file
291
src/vs/code/test/electron-main/windowsStateStorage.test.ts
Normal file
@@ -0,0 +1,291 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import * as os from 'os';
|
||||
import * as path from 'vs/base/common/path';
|
||||
|
||||
import { restoreWindowsState, getWindowsStateStoreData } from 'vs/code/electron-main/windowsStateStorage';
|
||||
import { IWindowState as IWindowUIState, WindowMode } from 'vs/platform/windows/electron-main/windows';
|
||||
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWindowsState, IWindowState } from 'vs/code/electron-main/windows';
|
||||
|
||||
function getUIState(): IWindowUIState {
|
||||
return {
|
||||
x: 0,
|
||||
y: 10,
|
||||
width: 100,
|
||||
height: 200,
|
||||
mode: 0
|
||||
};
|
||||
}
|
||||
|
||||
function toWorkspace(uri: URI): IWorkspaceIdentifier {
|
||||
return {
|
||||
id: '1234',
|
||||
configPath: uri
|
||||
};
|
||||
}
|
||||
function assertEqualURI(u1: URI | undefined, u2: URI | undefined, message?: string): void {
|
||||
assert.equal(u1 && u1.toString(), u2 && u2.toString(), message);
|
||||
}
|
||||
|
||||
function assertEqualWorkspace(w1: IWorkspaceIdentifier | undefined, w2: IWorkspaceIdentifier | undefined, message?: string): void {
|
||||
if (!w1 || !w2) {
|
||||
assert.equal(w1, w2, message);
|
||||
return;
|
||||
}
|
||||
assert.equal(w1.id, w2.id, message);
|
||||
assertEqualURI(w1.configPath, w2.configPath, message);
|
||||
}
|
||||
|
||||
function assertEqualWindowState(expected: IWindowState | undefined, actual: IWindowState | undefined, message?: string) {
|
||||
if (!expected || !actual) {
|
||||
assert.deepEqual(expected, actual, message);
|
||||
return;
|
||||
}
|
||||
assert.equal(expected.backupPath, actual.backupPath, message);
|
||||
assertEqualURI(expected.folderUri, actual.folderUri, message);
|
||||
assert.equal(expected.remoteAuthority, actual.remoteAuthority, message);
|
||||
assertEqualWorkspace(expected.workspace, actual.workspace, message);
|
||||
assert.deepEqual(expected.uiState, actual.uiState, message);
|
||||
}
|
||||
|
||||
function assertEqualWindowsState(expected: IWindowsState, actual: IWindowsState, message?: string) {
|
||||
assertEqualWindowState(expected.lastPluginDevelopmentHostWindow, actual.lastPluginDevelopmentHostWindow, message);
|
||||
assertEqualWindowState(expected.lastActiveWindow, actual.lastActiveWindow, message);
|
||||
assert.equal(expected.openedWindows.length, actual.openedWindows.length, message);
|
||||
for (let i = 0; i < expected.openedWindows.length; i++) {
|
||||
assertEqualWindowState(expected.openedWindows[i], actual.openedWindows[i], message);
|
||||
}
|
||||
}
|
||||
|
||||
function assertRestoring(state: IWindowsState, message?: string) {
|
||||
const stored = getWindowsStateStoreData(state);
|
||||
const restored = restoreWindowsState(stored);
|
||||
assertEqualWindowsState(state, restored, message);
|
||||
}
|
||||
|
||||
const testBackupPath1 = path.join(os.tmpdir(), 'windowStateTest', 'backupFolder1');
|
||||
const testBackupPath2 = path.join(os.tmpdir(), 'windowStateTest', 'backupFolder2');
|
||||
|
||||
const testWSPath = URI.file(path.join(os.tmpdir(), 'windowStateTest', 'test.code-workspace'));
|
||||
const testFolderURI = URI.file(path.join(os.tmpdir(), 'windowStateTest', 'testFolder'));
|
||||
|
||||
const testRemoteFolderURI = URI.parse('foo://bar/c/d');
|
||||
|
||||
suite('Windows State Storing', () => {
|
||||
test('storing and restoring', () => {
|
||||
let windowState: IWindowsState;
|
||||
windowState = {
|
||||
openedWindows: []
|
||||
};
|
||||
assertRestoring(windowState, 'no windows');
|
||||
windowState = {
|
||||
openedWindows: [{ backupPath: testBackupPath1, uiState: getUIState() }]
|
||||
};
|
||||
assertRestoring(windowState, 'empty workspace');
|
||||
|
||||
windowState = {
|
||||
openedWindows: [{ backupPath: testBackupPath1, uiState: getUIState(), workspace: toWorkspace(testWSPath) }]
|
||||
};
|
||||
assertRestoring(windowState, 'workspace');
|
||||
|
||||
windowState = {
|
||||
openedWindows: [{ backupPath: testBackupPath2, uiState: getUIState(), folderUri: testFolderURI }]
|
||||
};
|
||||
assertRestoring(windowState, 'folder');
|
||||
|
||||
windowState = {
|
||||
openedWindows: [{ backupPath: testBackupPath1, uiState: getUIState(), folderUri: testFolderURI }, { backupPath: testBackupPath1, uiState: getUIState(), folderUri: testRemoteFolderURI, remoteAuthority: 'bar' }]
|
||||
};
|
||||
assertRestoring(windowState, 'multiple windows');
|
||||
|
||||
windowState = {
|
||||
lastActiveWindow: { backupPath: testBackupPath2, uiState: getUIState(), folderUri: testFolderURI },
|
||||
openedWindows: []
|
||||
};
|
||||
assertRestoring(windowState, 'lastActiveWindow');
|
||||
|
||||
windowState = {
|
||||
lastPluginDevelopmentHostWindow: { backupPath: testBackupPath2, uiState: getUIState(), folderUri: testFolderURI },
|
||||
openedWindows: []
|
||||
};
|
||||
assertRestoring(windowState, 'lastPluginDevelopmentHostWindow');
|
||||
});
|
||||
|
||||
test('open 1_31', () => {
|
||||
const v1_31_workspace = `{
|
||||
"openedWindows": [],
|
||||
"lastActiveWindow": {
|
||||
"workspace": {
|
||||
"id": "a41787288b5e9cc1a61ba2dd84cd0d80",
|
||||
"configPath": "/home/user/workspaces/code-and-docs.code-workspace"
|
||||
},
|
||||
"backupPath": "/home/user/.config/Code - Insiders/Backups/a41787288b5e9cc1a61ba2dd84cd0d80",
|
||||
"uiState": {
|
||||
"mode": 0,
|
||||
"x": 0,
|
||||
"y": 27,
|
||||
"width": 2560,
|
||||
"height": 1364
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
let windowsState = restoreWindowsState(JSON.parse(v1_31_workspace));
|
||||
let expected: IWindowsState = {
|
||||
openedWindows: [],
|
||||
lastActiveWindow: {
|
||||
backupPath: '/home/user/.config/Code - Insiders/Backups/a41787288b5e9cc1a61ba2dd84cd0d80',
|
||||
uiState: { mode: WindowMode.Maximized, x: 0, y: 27, width: 2560, height: 1364 },
|
||||
workspace: { id: 'a41787288b5e9cc1a61ba2dd84cd0d80', configPath: URI.file('/home/user/workspaces/code-and-docs.code-workspace') }
|
||||
}
|
||||
};
|
||||
|
||||
assertEqualWindowsState(expected, windowsState, 'v1_31_workspace');
|
||||
|
||||
const v1_31_folder = `{
|
||||
"openedWindows": [],
|
||||
"lastPluginDevelopmentHostWindow": {
|
||||
"folderUri": {
|
||||
"$mid": 1,
|
||||
"fsPath": "/home/user/workspaces/testing/customdata",
|
||||
"external": "file:///home/user/workspaces/testing/customdata",
|
||||
"path": "/home/user/workspaces/testing/customdata",
|
||||
"scheme": "file"
|
||||
},
|
||||
"uiState": {
|
||||
"mode": 1,
|
||||
"x": 593,
|
||||
"y": 617,
|
||||
"width": 1625,
|
||||
"height": 595
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
windowsState = restoreWindowsState(JSON.parse(v1_31_folder));
|
||||
expected = {
|
||||
openedWindows: [],
|
||||
lastPluginDevelopmentHostWindow: {
|
||||
uiState: { mode: WindowMode.Normal, x: 593, y: 617, width: 1625, height: 595 },
|
||||
folderUri: URI.parse('file:///home/user/workspaces/testing/customdata')
|
||||
}
|
||||
};
|
||||
assertEqualWindowsState(expected, windowsState, 'v1_31_folder');
|
||||
|
||||
const v1_31_empty_window = ` {
|
||||
"openedWindows": [
|
||||
],
|
||||
"lastActiveWindow": {
|
||||
"backupPath": "C:\\\\Users\\\\Mike\\\\AppData\\\\Roaming\\\\Code\\\\Backups\\\\1549538599815",
|
||||
"uiState": {
|
||||
"mode": 0,
|
||||
"x": -8,
|
||||
"y": -8,
|
||||
"width": 2576,
|
||||
"height": 1344
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
windowsState = restoreWindowsState(JSON.parse(v1_31_empty_window));
|
||||
expected = {
|
||||
openedWindows: [],
|
||||
lastActiveWindow: {
|
||||
backupPath: 'C:\\Users\\Mike\\AppData\\Roaming\\Code\\Backups\\1549538599815',
|
||||
uiState: { mode: WindowMode.Maximized, x: -8, y: -8, width: 2576, height: 1344 }
|
||||
}
|
||||
};
|
||||
assertEqualWindowsState(expected, windowsState, 'v1_31_empty_window');
|
||||
|
||||
});
|
||||
|
||||
test('open 1_32', () => {
|
||||
const v1_32_workspace = `{
|
||||
"openedWindows": [],
|
||||
"lastActiveWindow": {
|
||||
"workspaceIdentifier": {
|
||||
"id": "53b714b46ef1a2d4346568b4f591028c",
|
||||
"configURIPath": "file:///home/user/workspaces/testing/custom.code-workspace"
|
||||
},
|
||||
"backupPath": "/home/user/.config/code-oss-dev/Backups/53b714b46ef1a2d4346568b4f591028c",
|
||||
"uiState": {
|
||||
"mode": 0,
|
||||
"x": 0,
|
||||
"y": 27,
|
||||
"width": 2560,
|
||||
"height": 1364
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
let windowsState = restoreWindowsState(JSON.parse(v1_32_workspace));
|
||||
let expected: IWindowsState = {
|
||||
openedWindows: [],
|
||||
lastActiveWindow: {
|
||||
backupPath: '/home/user/.config/code-oss-dev/Backups/53b714b46ef1a2d4346568b4f591028c',
|
||||
uiState: { mode: WindowMode.Maximized, x: 0, y: 27, width: 2560, height: 1364 },
|
||||
workspace: { id: '53b714b46ef1a2d4346568b4f591028c', configPath: URI.parse('file:///home/user/workspaces/testing/custom.code-workspace') }
|
||||
}
|
||||
};
|
||||
|
||||
assertEqualWindowsState(expected, windowsState, 'v1_32_workspace');
|
||||
|
||||
const v1_32_folder = `{
|
||||
"openedWindows": [],
|
||||
"lastActiveWindow": {
|
||||
"folder": "file:///home/user/workspaces/testing/folding",
|
||||
"backupPath": "/home/user/.config/code-oss-dev/Backups/1daac1621c6c06f9e916ac8062e5a1b5",
|
||||
"uiState": {
|
||||
"mode": 1,
|
||||
"x": 625,
|
||||
"y": 263,
|
||||
"width": 1718,
|
||||
"height": 953
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
windowsState = restoreWindowsState(JSON.parse(v1_32_folder));
|
||||
expected = {
|
||||
openedWindows: [],
|
||||
lastActiveWindow: {
|
||||
backupPath: '/home/user/.config/code-oss-dev/Backups/1daac1621c6c06f9e916ac8062e5a1b5',
|
||||
uiState: { mode: WindowMode.Normal, x: 625, y: 263, width: 1718, height: 953 },
|
||||
folderUri: URI.parse('file:///home/user/workspaces/testing/folding')
|
||||
}
|
||||
};
|
||||
assertEqualWindowsState(expected, windowsState, 'v1_32_folder');
|
||||
|
||||
const v1_32_empty_window = ` {
|
||||
"openedWindows": [
|
||||
],
|
||||
"lastActiveWindow": {
|
||||
"backupPath": "/home/user/.config/code-oss-dev/Backups/1549539668998",
|
||||
"uiState": {
|
||||
"mode": 1,
|
||||
"x": 768,
|
||||
"y": 336,
|
||||
"width": 1024,
|
||||
"height": 768
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
windowsState = restoreWindowsState(JSON.parse(v1_32_empty_window));
|
||||
expected = {
|
||||
openedWindows: [],
|
||||
lastActiveWindow: {
|
||||
backupPath: '/home/user/.config/code-oss-dev/Backups/1549539668998',
|
||||
uiState: { mode: WindowMode.Normal, x: 768, y: 336, width: 1024, height: 768 }
|
||||
}
|
||||
};
|
||||
assertEqualWindowsState(expected, windowsState, 'v1_32_empty_window');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { formatOptions, Option } from 'vs/platform/environment/node/argv';
|
||||
import { formatOptions, Option, addArg } from 'vs/platform/environment/node/argv';
|
||||
|
||||
suite('formatOptions', () => {
|
||||
|
||||
@@ -54,4 +54,13 @@ suite('formatOptions', () => {
|
||||
' bar bar bar bar bar bar bar bar bar '
|
||||
]);
|
||||
});
|
||||
|
||||
test('addArg', () => {
|
||||
assert.deepEqual(addArg([], 'foo'), ['foo']);
|
||||
assert.deepEqual(addArg([], 'foo', 'bar'), ['foo', 'bar']);
|
||||
assert.deepEqual(addArg(['foo'], 'bar'), ['foo', 'bar']);
|
||||
assert.deepEqual(addArg(['--wait'], 'bar'), ['--wait', 'bar']);
|
||||
assert.deepEqual(addArg(['--wait', '--', '--foo'], 'bar'), ['--wait', 'bar', '--', '--foo']);
|
||||
assert.deepEqual(addArg(['--', '--foo'], 'bar'), ['bar', '--', '--foo']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { findBestWindowOrFolderForFile, ISimpleWindow, IBestWindowOrFolderOptions } from 'vs/code/node/windowsFinder';
|
||||
import { OpenContext } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
@@ -15,17 +15,16 @@ const fixturesFolder = getPathFromAmdModule(require, './fixtures');
|
||||
|
||||
const testWorkspace: IWorkspaceIdentifier = {
|
||||
id: Date.now().toString(),
|
||||
configPath: path.join(fixturesFolder, 'workspaces.json')
|
||||
configPath: URI.file(path.join(fixturesFolder, 'workspaces.json'))
|
||||
};
|
||||
|
||||
function options(custom?: Partial<IBestWindowOrFolderOptions<ISimpleWindow>>): IBestWindowOrFolderOptions<ISimpleWindow> {
|
||||
return {
|
||||
windows: [],
|
||||
newWindow: false,
|
||||
reuseWindow: false,
|
||||
context: OpenContext.CLI,
|
||||
codeSettingsFolder: '_vscode',
|
||||
workspaceResolver: workspace => { return workspace === testWorkspace ? { id: testWorkspace.id, configPath: workspace.configPath, folders: toWorkspaceFolders([{ path: path.join(fixturesFolder, 'vscode_workspace_1_folder') }, { path: path.join(fixturesFolder, 'vscode_workspace_2_folder') }]) } : null!; },
|
||||
localWorkspaceResolver: workspace => { return workspace === testWorkspace ? { id: testWorkspace.id, configPath: workspace.configPath, folders: toWorkspaceFolders([{ path: path.join(fixturesFolder, 'vscode_workspace_1_folder') }, { path: path.join(fixturesFolder, 'vscode_workspace_2_folder') }]) } : null!; },
|
||||
...custom
|
||||
};
|
||||
}
|
||||
@@ -52,7 +51,6 @@ suite('WindowsFinder', () => {
|
||||
})), null);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
fileUri: URI.file(path.join(fixturesFolder, 'vscode_folder', 'file.txt')),
|
||||
reuseWindow: true
|
||||
})), null);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
fileUri: URI.file(path.join(fixturesFolder, 'vscode_folder', 'file.txt')),
|
||||
@@ -85,7 +83,6 @@ suite('WindowsFinder', () => {
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
windows: [lastActiveWindow, noVscodeFolderWindow],
|
||||
fileUri: URI.file(path.join(fixturesFolder, 'vscode_folder', 'file.txt')),
|
||||
reuseWindow: true
|
||||
})), lastActiveWindow);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
windows,
|
||||
|
||||
Reference in New Issue
Block a user