mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Electron v2.0.0 (#47289)
* Update to Electron 2.0.0-beta.7 * bump to electron 2.0.0-beta.7 * localStorage - workaround birthtime rounding issues that clear workspace storage * fix compile error * workaround #47569 * localStorage - add telemetry for successful migration * increment to localStorageTimers4 * localStorage - allow to restore from backup if starting with 1.7.x again * logLocalStorageMigrationStatus only on insider * back to official distro * 💄 * still use exploration distro * remove GTK3 emoji picker which does not seem to work * 💄
This commit is contained in:
parent
fe0177d9a9
commit
f7ec491c3e
2
.yarnrc
2
.yarnrc
|
@ -1,3 +1,3 @@
|
|||
disturl "https://atom.io/download/electron"
|
||||
target "1.7.12"
|
||||
target "2.0.0-beta.7"
|
||||
runtime "electron"
|
||||
|
|
|
@ -29,7 +29,7 @@ set ELECTRON_ENABLE_LOGGING=1
|
|||
set ELECTRON_ENABLE_STACK_DUMPING=1
|
||||
|
||||
:: Launch Code
|
||||
%CODE% --debug=5874 out\cli.js . %*
|
||||
%CODE% --inspect=5874 out\cli.js . %*
|
||||
popd
|
||||
|
||||
endlocal
|
||||
|
|
|
@ -32,7 +32,7 @@ function code() {
|
|||
VSCODE_DEV=1 \
|
||||
ELECTRON_ENABLE_LOGGING=1 \
|
||||
ELECTRON_ENABLE_STACK_DUMPING=1 \
|
||||
"$CODE" --debug=5874 "$ROOT/out/cli.js" . "$@"
|
||||
"$CODE" --inspect=5874 "$ROOT/out/cli.js" . "$@"
|
||||
}
|
||||
|
||||
code "$@"
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
||||
ROOT=$(dirname "$(dirname "$(realpath "$0")")")
|
||||
|
||||
# On Linux with Electron 2.0.x running out of a VM causes
|
||||
# a freeze so we only enable this flag on macOS
|
||||
export ELECTRON_ENABLE_LOGGING=1
|
||||
else
|
||||
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
|
||||
fi
|
||||
|
@ -40,7 +44,6 @@ function code() {
|
|||
export NODE_ENV=development
|
||||
export VSCODE_DEV=1
|
||||
export VSCODE_CLI=1
|
||||
export ELECTRON_ENABLE_LOGGING=1
|
||||
export ELECTRON_ENABLE_STACK_DUMPING=1
|
||||
|
||||
# Launch Code
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
||||
ROOT=$(dirname $(dirname $(realpath "$0")))
|
||||
|
||||
# On Linux with Electron 2.0.x running out of a VM causes
|
||||
# a freeze so we only enable this flag on macOS
|
||||
export ELECTRON_ENABLE_LOGGING=1
|
||||
else
|
||||
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
||||
fi
|
||||
|
@ -25,7 +29,6 @@ test -d node_modules || yarn
|
|||
node build/lib/electron.js || ./node_modules/.bin/gulp electron
|
||||
|
||||
# Unit Tests
|
||||
export ELECTRON_ENABLE_LOGGING=1
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
cd $ROOT ; ulimit -n 4096 ; \
|
||||
"$CODE" \
|
||||
|
|
1209
src/typings/electron.d.ts
vendored
1209
src/typings/electron.d.ts
vendored
File diff suppressed because it is too large
Load diff
9478
src/typings/node.d.ts
vendored
9478
src/typings/node.d.ts
vendored
File diff suppressed because it is too large
Load diff
|
@ -146,7 +146,7 @@ function showContextMenu(e) {
|
|||
})
|
||||
);
|
||||
|
||||
menu.popup(remote.getCurrentWindow());
|
||||
menu.popup({ window: remote.getCurrentWindow() });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ import { LogLevelSetterChannel } from 'vs/platform/log/common/logIpc';
|
|||
import { setUnexpectedErrorHandler } 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 { join } from 'path';
|
||||
import { copy, exists, rename } from 'vs/base/node/pfs';
|
||||
|
||||
export class CodeApplication {
|
||||
|
||||
|
@ -262,49 +264,55 @@ export class CodeApplication {
|
|||
this.logService.debug(`from: ${this.environmentService.appRoot}`);
|
||||
this.logService.debug('args:', this.environmentService.args);
|
||||
|
||||
// Make sure we associate the program with the app user model id
|
||||
// This will help Windows to associate the running program with
|
||||
// any shortcut that is pinned to the taskbar and prevent showing
|
||||
// two icons in the taskbar for the same app.
|
||||
if (platform.isWindows && product.win32AppUserModelId) {
|
||||
app.setAppUserModelId(product.win32AppUserModelId);
|
||||
}
|
||||
// Handle local storage (TODO@Ben remove me after a while)
|
||||
this.logService.trace('Handling localStorage if needed...');
|
||||
return this.handleLocalStorage().then(() => {
|
||||
|
||||
// Create Electron IPC Server
|
||||
this.electronIpcServer = new ElectronIPCServer();
|
||||
|
||||
// Resolve unique machine ID
|
||||
this.logService.trace('Resolving machine identifier...');
|
||||
return this.resolveMachineId().then(machineId => {
|
||||
this.logService.trace(`Resolved machine identifier: ${machineId}`);
|
||||
|
||||
// Spawn shared process
|
||||
this.sharedProcess = new SharedProcess(this.environmentService, this.lifecycleService, this.logService, machineId, this.userEnv);
|
||||
this.sharedProcessClient = this.sharedProcess.whenReady().then(() => connect(this.environmentService.sharedIPCHandle, 'main'));
|
||||
|
||||
// Services
|
||||
const appInstantiationService = this.initServices(machineId);
|
||||
|
||||
let promise: TPromise<any> = TPromise.as(null);
|
||||
|
||||
// Create driver
|
||||
if (this.environmentService.driverHandle) {
|
||||
serveDriver(this.electronIpcServer, this.environmentService.driverHandle, appInstantiationService).then(server => {
|
||||
this.logService.info('Driver started at:', this.environmentService.driverHandle);
|
||||
this.toDispose.push(server);
|
||||
});
|
||||
// Make sure we associate the program with the app user model id
|
||||
// This will help Windows to associate the running program with
|
||||
// any shortcut that is pinned to the taskbar and prevent showing
|
||||
// two icons in the taskbar for the same app.
|
||||
if (platform.isWindows && product.win32AppUserModelId) {
|
||||
app.setAppUserModelId(product.win32AppUserModelId);
|
||||
}
|
||||
|
||||
return promise.then(() => {
|
||||
// Setup Auth Handler
|
||||
const authHandler = appInstantiationService.createInstance(ProxyAuthHandler);
|
||||
this.toDispose.push(authHandler);
|
||||
// Create Electron IPC Server
|
||||
this.electronIpcServer = new ElectronIPCServer();
|
||||
|
||||
// Open Windows
|
||||
appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor));
|
||||
// Resolve unique machine ID
|
||||
this.logService.trace('Resolving machine identifier...');
|
||||
return this.resolveMachineId().then(machineId => {
|
||||
this.logService.trace(`Resolved machine identifier: ${machineId}`);
|
||||
|
||||
// Post Open Windows Tasks
|
||||
appInstantiationService.invokeFunction(accessor => this.afterWindowOpen(accessor));
|
||||
// Spawn shared process
|
||||
this.sharedProcess = new SharedProcess(this.environmentService, this.lifecycleService, this.logService, machineId, this.userEnv);
|
||||
this.sharedProcessClient = this.sharedProcess.whenReady().then(() => connect(this.environmentService.sharedIPCHandle, 'main'));
|
||||
|
||||
// Services
|
||||
const appInstantiationService = this.initServices(machineId);
|
||||
|
||||
let promise: TPromise<any> = TPromise.as(null);
|
||||
|
||||
// Create driver
|
||||
if (this.environmentService.driverHandle) {
|
||||
serveDriver(this.electronIpcServer, this.environmentService.driverHandle, appInstantiationService).then(server => {
|
||||
this.logService.info('Driver started at:', this.environmentService.driverHandle);
|
||||
this.toDispose.push(server);
|
||||
});
|
||||
}
|
||||
|
||||
return promise.then(() => {
|
||||
|
||||
// Setup Auth Handler
|
||||
const authHandler = appInstantiationService.createInstance(ProxyAuthHandler);
|
||||
this.toDispose.push(authHandler);
|
||||
|
||||
// Open Windows
|
||||
appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor));
|
||||
|
||||
// Post Open Windows Tasks
|
||||
appInstantiationService.invokeFunction(accessor => this.afterWindowOpen(accessor));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -324,6 +332,36 @@ export class CodeApplication {
|
|||
});
|
||||
}
|
||||
|
||||
private handleLocalStorage(): TPromise<void> {
|
||||
const localStorageFile = join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage');
|
||||
const localStorageJournalFile = join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage-journal');
|
||||
const localStorageBackupFile = join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage.vscbak');
|
||||
const localStorageJournalBackupFile = join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage-journal.vscbak');
|
||||
|
||||
// Electron 1.7.12: Restore storage
|
||||
if (process.versions.electron === '1.7.12') {
|
||||
return exists(localStorageBackupFile).then(localStorageBackupFileExists => {
|
||||
return exists(localStorageJournalBackupFile).then(localStorageJournalBackupFileExists => {
|
||||
return TPromise.join([
|
||||
localStorageBackupFileExists ? rename(localStorageBackupFile, localStorageFile) : TPromise.as(void 0),
|
||||
localStorageJournalBackupFileExists ? rename(localStorageJournalBackupFile, localStorageJournalFile) : TPromise.as(void 0)
|
||||
]);
|
||||
});
|
||||
}).then(() => void 0, () => void 0);
|
||||
}
|
||||
|
||||
// Electron 2.0: Backup
|
||||
else {
|
||||
return exists(localStorageBackupFile).then(backupExists => {
|
||||
if (backupExists) {
|
||||
return void 0; // do not backup if backup already exists
|
||||
}
|
||||
|
||||
return copy(localStorageFile, localStorageBackupFile).then(() => copy(localStorageJournalFile, localStorageJournalBackupFile));
|
||||
}).then(() => void 0, () => void 0);
|
||||
}
|
||||
}
|
||||
|
||||
private initServices(machineId: string): IInstantiationService {
|
||||
const services = new ServiceCollection();
|
||||
|
||||
|
@ -481,4 +519,4 @@ export class CodeApplication {
|
|||
private dispose(): void {
|
||||
this.toDispose = dispose(this.toDispose);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -186,23 +186,6 @@ export class CodeWindow implements ICodeWindow {
|
|||
this._win = new BrowserWindow(options);
|
||||
this._id = this._win.id;
|
||||
|
||||
// Bug in Electron (https://github.com/electron/electron/issues/10862). On multi-monitor setups,
|
||||
// it can happen that the position we set to the window is not the correct one on the display.
|
||||
// To workaround, we ask the window for its position and set it again if not matching.
|
||||
// This only applies if the window is not fullscreen or maximized and multiple monitors are used.
|
||||
if (isWindows && !isFullscreenOrMaximized) {
|
||||
try {
|
||||
if (screen.getAllDisplays().length > 1) {
|
||||
const [x, y] = this._win.getPosition();
|
||||
if (x !== this.windowState.x || y !== this.windowState.y) {
|
||||
this._win.setPosition(this.windowState.x, this.windowState.y, false);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
this.logService.warn(`Unexpected error fixing window position on windows with multiple windows: ${err}\n${err.stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (useCustomTitleStyle) {
|
||||
this._win.setSheetOffset(22); // offset dialogs by the height of the custom title bar if we have any
|
||||
}
|
||||
|
@ -955,11 +938,6 @@ export class CodeWindow implements ICodeWindow {
|
|||
this.touchBarGroups.push(groupTouchBar);
|
||||
}
|
||||
|
||||
// Ugly workaround for native crash on macOS 10.12.1. We are not
|
||||
// leveraging the API for changing the ESC touch bar item.
|
||||
// See https://github.com/electron/electron/issues/10442
|
||||
(<any>this._win)._setEscapeTouchBarItem = () => { };
|
||||
|
||||
this._win.setTouchBar(new TouchBar({ items: this.touchBarGroups }));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
|||
|
||||
protected setUpdateFeedUrl(quality: string): boolean {
|
||||
try {
|
||||
electron.autoUpdater.setFeedURL(createUpdateURL('darwin', quality));
|
||||
electron.autoUpdater.setFeedURL({ url: createUpdateURL('darwin', quality) });
|
||||
} catch (e) {
|
||||
// application is very likely not signed
|
||||
this.logService.error('Failed to set update feed URL');
|
||||
|
|
|
@ -24,12 +24,15 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
|||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { dispose, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ToggleActivityBarVisibilityAction } from 'vs/workbench/browser/actions/toggleActivityBarVisibility';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { CompositeBar } from 'vs/workbench/browser/parts/compositebar/compositeBar';
|
||||
import { ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositebar/compositeBarActions';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { Dimension, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
||||
export class ActivitybarPart extends Part {
|
||||
|
||||
|
@ -57,7 +60,8 @@ export class ActivitybarPart extends Part {
|
|||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IPartService private partService: IPartService,
|
||||
@IThemeService themeService: IThemeService
|
||||
@IThemeService themeService: IThemeService,
|
||||
@ILifecycleService private lifecycleService: ILifecycleService
|
||||
) {
|
||||
super(id, { hasTitle: false }, themeService);
|
||||
|
||||
|
@ -131,6 +135,27 @@ export class ActivitybarPart extends Part {
|
|||
// Top Actionbar with action items for each viewlet action
|
||||
this.createGlobalActivityActionBar($('.global-activity').appendTo($result).getHTMLElement());
|
||||
|
||||
// TODO@Ben: workaround for https://github.com/Microsoft/vscode/issues/45700
|
||||
// It looks like there are rendering glitches on macOS with Chrome 61 when
|
||||
// using --webkit-mask with a background color that is different from the image
|
||||
// The workaround is to promote the element onto its own drawing layer. We do
|
||||
// this only after the workbench has loaded because otherwise there is ugly flicker.
|
||||
if (isMacintosh) {
|
||||
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
|
||||
scheduleAtNextAnimationFrame(() => { // another delay...
|
||||
scheduleAtNextAnimationFrame(() => { // ...to prevent more flickering on startup
|
||||
registerThemingParticipant((theme, collector) => {
|
||||
const activityBarForeground = theme.getColor(ACTIVITY_BAR_FOREGROUND);
|
||||
if (activityBarForeground && !activityBarForeground.equals(Color.white)) {
|
||||
// only apply this workaround if the color is different from the image one (white)
|
||||
collector.addRule('.monaco-workbench .activitybar > .content > .composite-bar > .monaco-action-bar .action-label { will-change: transform; }');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return $result.getHTMLElement();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
|
|||
import { EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { ExtensionService } from 'vs/workbench/services/extensions/electron-browser/extensionService';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
|
@ -83,7 +83,7 @@ import { HashService } from 'vs/workbench/services/hash/node/hashService';
|
|||
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { WORKBENCH_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { stat } from 'fs';
|
||||
import { stat, existsSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { ILocalizationsChannel, LocalizationsChannelClient } from 'vs/platform/localizations/common/localizationsIpc';
|
||||
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
|
@ -128,6 +128,7 @@ export class WorkbenchShell {
|
|||
private lifecycleService: LifecycleService;
|
||||
private mainProcessServices: ServiceCollection;
|
||||
private notificationService: INotificationService;
|
||||
private mainProcessClient: IPCClient;
|
||||
|
||||
private container: HTMLElement;
|
||||
private toUnbind: IDisposable[];
|
||||
|
@ -139,7 +140,9 @@ export class WorkbenchShell {
|
|||
private configuration: IWindowConfiguration;
|
||||
private workbench: Workbench;
|
||||
|
||||
constructor(container: HTMLElement, coreServices: ICoreServices, mainProcessServices: ServiceCollection, private mainProcessClient: IPCClient, configuration: IWindowConfiguration) {
|
||||
private hasLocalStorageData: boolean;
|
||||
|
||||
constructor(container: HTMLElement, coreServices: ICoreServices, mainProcessServices: ServiceCollection, mainProcessClient: IPCClient, configuration: IWindowConfiguration) {
|
||||
this.container = container;
|
||||
|
||||
this.configuration = configuration;
|
||||
|
@ -152,9 +155,13 @@ export class WorkbenchShell {
|
|||
this.storageService = coreServices.storageService;
|
||||
|
||||
this.mainProcessServices = mainProcessServices;
|
||||
this.mainProcessClient = mainProcessClient;
|
||||
|
||||
this.toUnbind = [];
|
||||
this.previousErrorTime = 0;
|
||||
|
||||
// TODO@Ben remove me later
|
||||
this.hasLocalStorageData = !!this.storageService.get('releaseNotes/lastVersion', StorageScope.GLOBAL);
|
||||
}
|
||||
|
||||
private createContents(parent: HTMLElement): HTMLElement {
|
||||
|
@ -220,6 +227,11 @@ export class WorkbenchShell {
|
|||
if (!this.environmentService.extensionTestsPath && this.contextService.getWorkbenchState() === WorkbenchState.FOLDER) {
|
||||
this.logLocalStorageMetrics();
|
||||
}
|
||||
|
||||
// localStorage migration (TODO@Ben remove me later)
|
||||
if (!this.environmentService.extensionTestsPath) {
|
||||
this.logLocalStorageMigrationStatus();
|
||||
}
|
||||
});
|
||||
|
||||
return workbench;
|
||||
|
@ -294,17 +306,17 @@ export class WorkbenchShell {
|
|||
}
|
||||
|
||||
perf.mark('willReadLocalStorage');
|
||||
const readyToSend = this.storageService.getBoolean('localStorageMetricsReadyToSend2');
|
||||
const readyToSend = this.storageService.getBoolean('localStorageMetricsReadyToSend4');
|
||||
perf.mark('didReadLocalStorage');
|
||||
|
||||
if (!readyToSend) {
|
||||
this.storageService.store('localStorageMetricsReadyToSend2', true);
|
||||
this.storageService.store('localStorageMetricsReadyToSend4', true);
|
||||
return; // avoid logging localStorage metrics directly after the update, we prefer cold startup numbers
|
||||
}
|
||||
|
||||
if (!this.storageService.getBoolean('localStorageMetricsSent2')) {
|
||||
if (!this.storageService.getBoolean('localStorageMetricsSent4')) {
|
||||
perf.mark('willWriteLocalStorage');
|
||||
this.storageService.store('localStorageMetricsSent2', true);
|
||||
this.storageService.store('localStorageMetricsSent4', true);
|
||||
perf.mark('didWriteLocalStorage');
|
||||
|
||||
perf.mark('willStatLocalStorage');
|
||||
|
@ -312,7 +324,7 @@ export class WorkbenchShell {
|
|||
perf.mark('didStatLocalStorage');
|
||||
|
||||
/* __GDPR__
|
||||
"localStorageTimers2" : {
|
||||
"localStorageTimers4" : {
|
||||
"statTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"accessTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"firstReadTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
|
@ -322,7 +334,7 @@ export class WorkbenchShell {
|
|||
"size": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('localStorageTimers2', {
|
||||
this.telemetryService.publicLog('localStorageTimers4', {
|
||||
'statTime': perf.getDuration('willStatLocalStorage', 'didStatLocalStorage'),
|
||||
'accessTime': perf.getDuration('willAccessLocalStorage', 'didAccessLocalStorage'),
|
||||
'firstReadTime': perf.getDuration('willReadWorkspaceIdentifier', 'didReadWorkspaceIdentifier'),
|
||||
|
@ -335,6 +347,38 @@ export class WorkbenchShell {
|
|||
}
|
||||
}
|
||||
|
||||
private logLocalStorageMigrationStatus(): void {
|
||||
if (product.quality === 'insider' && !this.storageService.getBoolean('localStorageMigrationStatusLogged')) {
|
||||
this.storageService.store('localStorageMigrationStatusLogged', true);
|
||||
|
||||
stat(join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage.vscbak'), (error, stat) => {
|
||||
// if we have a backup of localStorage it means a migration was attempted
|
||||
// by Electron 2.0. We log to telemetry if we had data initially which means
|
||||
// the migration was successful.
|
||||
if (stat) {
|
||||
/* __GDPR__
|
||||
"localStorageMigrationStatus" : {
|
||||
"platform": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"arch": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"migrated": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"size": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"sqliteStillExists": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"sqliteJournalExists": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('localStorageMigrationStatus', {
|
||||
'platform': process.platform,
|
||||
'arch': process.arch,
|
||||
'migrated': this.hasLocalStorageData,
|
||||
'size': stat.size,
|
||||
'sqliteStillExists': existsSync(join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage')),
|
||||
'sqliteJournalExists': existsSync(join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage-journal'))
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private initServiceCollection(container: HTMLElement): [IInstantiationService, ServiceCollection] {
|
||||
const serviceCollection = new ServiceCollection();
|
||||
serviceCollection.set(IWorkspaceContextService, this.contextService);
|
||||
|
|
|
@ -13,6 +13,24 @@ import { Protocol } from 'vs/base/parts/ipc/node/ipc.net';
|
|||
import { createConnection } from 'net';
|
||||
import { Event, filterEvent } from 'vs/base/common/event';
|
||||
|
||||
// TODO@ben: with Electron 2.x and node.js 8.x the "natives" module
|
||||
// can cause a native crash (see https://github.com/nodejs/node/issues/19891 and
|
||||
// https://github.com/electron/electron/issues/10905). To prevent this from
|
||||
// happening we essentially blocklist this module from getting loaded in any
|
||||
// extension by patching the node require() function.
|
||||
(function () {
|
||||
const Module = require.__$__nodeRequire('module') as any;
|
||||
const originalLoad = Module._load;
|
||||
|
||||
Module._load = function (request) {
|
||||
if (request === 'natives') {
|
||||
throw new Error('Either the extension or a NPM dependency is using the "natives" node module which is unsupported as it can cause a crash of the extension host. Click [here](https://go.microsoft.com/fwlink/?linkid=871887) to find out more');
|
||||
}
|
||||
|
||||
return originalLoad.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
interface IRendererConnection {
|
||||
protocol: IMessagePassingProtocol;
|
||||
initData: IInitData;
|
||||
|
@ -128,8 +146,6 @@ createExtHostProtocol().then(protocol => {
|
|||
return extensionHostMain.start();
|
||||
}).catch(err => console.error(err));
|
||||
|
||||
|
||||
|
||||
function patchExecArgv() {
|
||||
// when encountering the prevent-inspect flag we delete this
|
||||
// and the prior flag
|
||||
|
|
|
@ -16,8 +16,8 @@ import { Queue } from 'vs/base/common/async';
|
|||
import { stat, writeFile } from 'vs/base/node/pfs';
|
||||
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { IWorkspaceContextService, Workspace, WorkbenchState, IWorkspaceFolder, toWorkspaceFolders, IWorkspaceFoldersChangeEvent, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { isLinux, isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ConfigurationChangeEvent, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels';
|
||||
import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, keyFromOverrideIdentifier, isConfigurationOverrides, IConfigurationData } from 'vs/platform/configuration/common/configuration';
|
||||
|
@ -344,7 +344,19 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
|
|||
const folderPath = URI.file(singleFolderWorkspaceIdentifier);
|
||||
return stat(folderPath.fsPath)
|
||||
.then(workspaceStat => {
|
||||
const ctime = isLinux ? workspaceStat.ino : workspaceStat.birthtime.getTime(); // On Linux, birthtime is ctime, so we cannot use it! We use the ino instead!
|
||||
let ctime: number;
|
||||
if (isLinux) {
|
||||
ctime = workspaceStat.ino; // Linux: birthtime is ctime, so we cannot use it! We use the ino instead!
|
||||
} else if (isMacintosh) {
|
||||
ctime = workspaceStat.birthtime.getTime(); // macOS: birthtime is fine to use as is
|
||||
} else if (isWindows) {
|
||||
if (typeof workspaceStat.birthtimeMs === 'number') {
|
||||
ctime = Math.floor(workspaceStat.birthtimeMs); // Windows: fix precision issue in node.js 8.x to get 7.x results (see https://github.com/nodejs/node/issues/19897)
|
||||
} else {
|
||||
ctime = workspaceStat.birthtime.getTime();
|
||||
}
|
||||
}
|
||||
|
||||
const id = createHash('md5').update(folderPath.fsPath).update(ctime ? String(ctime) : '').digest('hex');
|
||||
const folder = URI.file(folderPath.fsPath);
|
||||
return new Workspace(id, getBaseLabel(folder), toWorkspaceFolders([{ path: folder.fsPath }]), null, ctime);
|
||||
|
|
|
@ -18,6 +18,7 @@ import { unmnemonicLabel } from 'vs/base/common/labels';
|
|||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IContextMenuDelegate, ContextSubMenu, IEvent } from 'vs/base/browser/contextmenu';
|
||||
import { once } from 'vs/base/common/functional';
|
||||
|
||||
export class ContextMenuService implements IContextMenuService {
|
||||
|
||||
|
@ -42,7 +43,15 @@ export class ContextMenuService implements IContextMenuService {
|
|||
}
|
||||
|
||||
return TPromise.timeout(0).then(() => { // https://github.com/Microsoft/vscode/issues/3638
|
||||
const menu = this.createMenu(delegate, actions);
|
||||
const onHide = once(() => {
|
||||
if (delegate.onHide) {
|
||||
delegate.onHide(undefined);
|
||||
}
|
||||
|
||||
this._onDidContextMenu.fire();
|
||||
});
|
||||
|
||||
const menu = this.createMenu(delegate, actions, onHide);
|
||||
const anchor = delegate.getAnchor();
|
||||
let x: number, y: number;
|
||||
|
||||
|
@ -61,16 +70,18 @@ export class ContextMenuService implements IContextMenuService {
|
|||
x *= zoom;
|
||||
y *= zoom;
|
||||
|
||||
menu.popup(remote.getCurrentWindow(), { x: Math.floor(x), y: Math.floor(y), positioningItem: delegate.autoSelectFirstItem ? 0 : void 0 });
|
||||
this._onDidContextMenu.fire();
|
||||
if (delegate.onHide) {
|
||||
delegate.onHide(undefined);
|
||||
}
|
||||
menu.popup({
|
||||
window: remote.getCurrentWindow(),
|
||||
x: Math.floor(x),
|
||||
y: Math.floor(y),
|
||||
positioningItem: delegate.autoSelectFirstItem ? 0 : void 0,
|
||||
callback: () => onHide()
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private createMenu(delegate: IContextMenuDelegate, entries: (IAction | ContextSubMenu)[]): Electron.Menu {
|
||||
private createMenu(delegate: IContextMenuDelegate, entries: (IAction | ContextSubMenu)[], onHide: () => void): Electron.Menu {
|
||||
const menu = new remote.Menu();
|
||||
const actionRunner = delegate.actionRunner || new ActionRunner();
|
||||
|
||||
|
@ -79,7 +90,7 @@ export class ContextMenuService implements IContextMenuService {
|
|||
menu.append(new remote.MenuItem({ type: 'separator' }));
|
||||
} else if (e instanceof ContextSubMenu) {
|
||||
const submenu = new remote.MenuItem({
|
||||
submenu: this.createMenu(delegate, e.entries),
|
||||
submenu: this.createMenu(delegate, e.entries, onHide),
|
||||
label: unmnemonicLabel(e.label)
|
||||
});
|
||||
|
||||
|
@ -91,6 +102,13 @@ export class ContextMenuService implements IContextMenuService {
|
|||
type: !!e.checked ? 'checkbox' : !!e.radio ? 'radio' : void 0,
|
||||
enabled: !!e.enabled,
|
||||
click: (menuItem, win, event) => {
|
||||
|
||||
// To preserve pre-electron-2.x behaviour, we first trigger
|
||||
// the onHide callback and then the action.
|
||||
// Fixes https://github.com/Microsoft/vscode/issues/45601
|
||||
onHide();
|
||||
|
||||
// Run action which will close the menu
|
||||
this.runAction(actionRunner, e, delegate, event);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -193,13 +193,13 @@ export class ExtensionHostProcessWorker {
|
|||
}, 100);
|
||||
|
||||
// Print out extension host output
|
||||
onDebouncedOutput(data => {
|
||||
const inspectorUrlIndex = !this._environmentService.isBuilt && data.data && data.data.indexOf('chrome-devtools://');
|
||||
if (inspectorUrlIndex >= 0) {
|
||||
console.log(`%c[Extension Host] %cdebugger inspector at ${data.data.substr(inspectorUrlIndex)}`, 'color: blue', 'color: black');
|
||||
onDebouncedOutput(output => {
|
||||
const inspectorUrlMatch = !this._environmentService.isBuilt && output.data && output.data.match(/ws:\/\/([^\s]+)/);
|
||||
if (inspectorUrlMatch) {
|
||||
console.log(`%c[Extension Host] %cdebugger inspector at chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=${inspectorUrlMatch[1]}`, 'color: blue', 'color: black');
|
||||
} else {
|
||||
console.group('Extension Host');
|
||||
console.log(data.data, ...data.format);
|
||||
console.log(output.data, ...output.format);
|
||||
console.groupEnd();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue