mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
Update to Electron v2.0.0-beta.6 (#46552)
* electron@2.0.0-beta-1 * Update distro * Update electron.d.ts to 2.0.0-beta.1 * Disable asar as it causes a native crash * Adopt Module._resolveLookupPaths ASAR patch * electron 2.x - restore inspector URL in extension host * electron 2.x - adopt context menu callback for onHide * electron 2.x - remove workaround for https://github.com/electron/electron/issues/10442 * electron 2.x - update node.d.ts * electron 2.x - update node.d.ts to 8.9.x * electron 2.x - keep node.d.ts changes to a minimum * electron 2.x - remove workaround for https://github.com/electron/electron/issues/10862 * electron 2.x - bump to 2.0.0-beta2 * bump to 2.0.0-beta.3 * Context menu: selecting "Rename" does not put focs into rename box (fix #45601) * quality "exploration" for easier testing * empty commit * push a workaround for #45700 * Certain themes show UI artifacts over activity bar icons (fixes #45700) * better fix for #45700 * bump to 2.0.0-beta.4 * another fix to prevent flickering for #45700 * avoid remote access in index.js * bump distro commit * electron 2.x - do not use --debug anymore * bump electron to 2.0.0-beta.5 * electron 2.x - add libgtk-3-dev as build dependency for Linux 64 * electron 2.x - workaround freeze on linux on startup * bump local storage telemetry key * electron 2.x - do a one time backup of local storage * enable ELECTRON_ENABLE_LOGGING on macOS at least * 2.0.0-beta.6 * Fix ctrl+shift+e not focusing explorer on Linux * distro - use GH electron builds for now
This commit is contained in:
parent
ef55294a20
commit
88603b377d
2
.yarnrc
2
.yarnrc
|
@ -1,3 +1,3 @@
|
|||
disturl "https://atom.io/download/electron"
|
||||
target "1.7.12"
|
||||
target "2.0.0-beta.6"
|
||||
runtime "electron"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.23.0",
|
||||
"distro": "ed36a29ddadc357cdceba6ff5e3e7d5e27893dee",
|
||||
"distro": "6834b79a655ade3dce6df4799a264ff29bff6652",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
|
@ -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" \
|
||||
|
|
|
@ -448,7 +448,6 @@ global.getOpenUrls = function () {
|
|||
return openUrls;
|
||||
};
|
||||
|
||||
|
||||
// use '<UserData>/CachedData'-directory to store
|
||||
// node/v8 cached data.
|
||||
let nodeCachedDataDir = getNodeCachedDataDir().then(function (value) {
|
||||
|
|
1213
src/typings/electron.d.ts
vendored
1213
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
|
@ -381,7 +381,7 @@ export interface IQueuedSender {
|
|||
// queue is free again to consume messages.
|
||||
// On Windows we always wait for the send() method to return before sending the next message
|
||||
// to workaround https://github.com/nodejs/node/issues/7657 (IPC can freeze process)
|
||||
export function createQueuedSender(childProcess: cp.ChildProcess | NodeJS.Process): IQueuedSender {
|
||||
export function createQueuedSender(childProcess: cp.ChildProcess): IQueuedSender {
|
||||
let msgQueue: string[] = [];
|
||||
let useQueue = false;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ export function request(options: IRequestOptions): TPromise<IRequestContext> {
|
|||
stream = stream.pipe(createGunzip());
|
||||
}
|
||||
|
||||
c({ res, stream });
|
||||
c({ res, stream } as IRequestContext);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ suite('Arrays', () => {
|
|||
for (let i = 1; i < array.length; i++) {
|
||||
let n = array[i];
|
||||
if (last > n) {
|
||||
assert.fail(array.slice(i - 10, i + 10));
|
||||
assert.fail(JSON.stringify(array.slice(i - 10, i + 10)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ suite('Cache', () => {
|
|||
const cache = new Cache(() => TPromise.as(counter++));
|
||||
|
||||
return cache.get()
|
||||
.then(c => assert.equal(c, 0), () => assert.fail())
|
||||
.then(c => assert.equal(c, 0), () => assert.fail('Unexpected assertion error'))
|
||||
.then(() => cache.get())
|
||||
.then(c => assert.equal(c, 0), () => assert.fail());
|
||||
.then(c => assert.equal(c, 0), () => assert.fail('Unexpected assertion error'));
|
||||
});
|
||||
|
||||
test('simple error', () => {
|
||||
|
@ -26,9 +26,9 @@ suite('Cache', () => {
|
|||
const cache = new Cache(() => TPromise.wrapError(new Error(String(counter++))));
|
||||
|
||||
return cache.get()
|
||||
.then(() => assert.fail(), err => assert.equal(err.message, 0))
|
||||
.then(() => assert.fail('Unexpected assertion error'), err => assert.equal(err.message, 0))
|
||||
.then(() => cache.get())
|
||||
.then(() => assert.fail(), err => assert.equal(err.message, 0));
|
||||
.then(() => assert.fail('Unexpected assertion error'), err => assert.equal(err.message, 0));
|
||||
});
|
||||
|
||||
test('should retry cancellations', () => {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as processes from 'vs/base/node/processes';
|
||||
|
||||
const sender = processes.createQueuedSender(process);
|
||||
const sender = processes.createQueuedSender(<any>process);
|
||||
|
||||
process.on('message', msg => {
|
||||
sender.send(msg);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as processes from 'vs/base/node/processes';
|
||||
|
||||
const sender = processes.createQueuedSender(process);
|
||||
const sender = processes.createQueuedSender(<any>process);
|
||||
|
||||
process.on('message', msg => {
|
||||
sender.send(msg);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { app, ipcMain as ipc, BrowserWindow } from 'electron';
|
||||
import { app, ipcMain as ipc } from 'electron';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { WindowsManager } from 'vs/code/electron-main/windows';
|
||||
import { IWindowsService, OpenContext, ActiveWindowManager } from 'vs/platform/windows/common/windows';
|
||||
|
@ -59,11 +59,14 @@ import { IssueChannel } from 'vs/platform/issue/common/issueIpc';
|
|||
import { IssueService } from 'vs/platform/issue/electron-main/issueService';
|
||||
import { LogLevelSetterChannel } from 'vs/platform/log/common/logIpc';
|
||||
import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
import { join } from 'path';
|
||||
import { copy } from 'vs/base/node/pfs';
|
||||
import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlListener';
|
||||
|
||||
export class CodeApplication {
|
||||
|
||||
private static readonly MACHINE_ID_KEY = 'telemetry.machineId';
|
||||
private static readonly LOCAL_STORAGE_BACKED_UP_KEY = 'localStorage.backedUp';
|
||||
|
||||
private toDispose: IDisposable[];
|
||||
private windowsMainService: IWindowsMainService;
|
||||
|
@ -127,7 +130,7 @@ export class CodeApplication {
|
|||
return srcUri.startsWith(URI.file(this.environmentService.appRoot.toLowerCase()).toString());
|
||||
};
|
||||
|
||||
app.on('web-contents-created', (_event: any, contents) => {
|
||||
app.on('web-contents-created', (event: any, contents) => {
|
||||
contents.on('will-attach-webview', (event: Electron.Event, webPreferences, params) => {
|
||||
delete webPreferences.preload;
|
||||
webPreferences.nodeIntegration = false;
|
||||
|
@ -182,15 +185,15 @@ export class CodeApplication {
|
|||
this.windowsMainService.openNewWindow(OpenContext.DESKTOP); //macOS native tab "+" button
|
||||
});
|
||||
|
||||
ipc.on('vscode:exit', (_event: any, code: number) => {
|
||||
ipc.on('vscode:exit', (event: any, code: number) => {
|
||||
this.logService.trace('IPC#vscode:exit', code);
|
||||
|
||||
this.dispose();
|
||||
this.lifecycleService.kill(code);
|
||||
});
|
||||
|
||||
ipc.on('vscode:fetchShellEnv', (_event: any, windowId: number) => {
|
||||
const { webContents } = BrowserWindow.fromId(windowId);
|
||||
ipc.on('vscode:fetchShellEnv', event => {
|
||||
const webContents = event.sender.webContents;
|
||||
getShellEnvironment().then(shellEnv => {
|
||||
if (!webContents.isDestroyed()) {
|
||||
webContents.send('vscode:acceptShellEnv', shellEnv);
|
||||
|
@ -204,7 +207,7 @@ export class CodeApplication {
|
|||
});
|
||||
});
|
||||
|
||||
ipc.on('vscode:broadcast', (_event: any, windowId: number, broadcast: { channel: string; payload: any; }) => {
|
||||
ipc.on('vscode:broadcast', (event: any, windowId: number, broadcast: { channel: string; payload: any; }) => {
|
||||
if (this.windowsMainService && broadcast.channel && !isUndefinedOrNull(broadcast.payload)) {
|
||||
this.logService.trace('IPC#vscode:broadcast', broadcast.channel, broadcast.payload);
|
||||
|
||||
|
@ -261,38 +264,43 @@ 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);
|
||||
}
|
||||
// Backup local storage (TODO@Ben remove me after a while)
|
||||
this.logService.trace('Backing up localStorage if needed...');
|
||||
return this.backupLocalStorage().then(() => {
|
||||
|
||||
// Create Electron IPC Server
|
||||
this.electronIpcServer = new ElectronIPCServer();
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Resolve unique machine ID
|
||||
this.logService.trace('Resolving machine identifier...');
|
||||
return this.resolveMachineId().then(machineId => {
|
||||
this.logService.trace(`Resolved machine identifier: ${machineId}`);
|
||||
// Create Electron IPC Server
|
||||
this.electronIpcServer = new ElectronIPCServer();
|
||||
|
||||
// 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'));
|
||||
// Resolve unique machine ID
|
||||
this.logService.trace('Resolving machine identifier...');
|
||||
return this.resolveMachineId().then(machineId => {
|
||||
this.logService.trace(`Resolved machine identifier: ${machineId}`);
|
||||
|
||||
// Services
|
||||
const appInstantiationService = this.initServices(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'));
|
||||
|
||||
// Setup Auth Handler
|
||||
const authHandler = appInstantiationService.createInstance(ProxyAuthHandler);
|
||||
this.toDispose.push(authHandler);
|
||||
// Services
|
||||
const appInstantiationService = this.initServices(machineId);
|
||||
|
||||
// Open Windows
|
||||
appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor));
|
||||
// Setup Auth Handler
|
||||
const authHandler = appInstantiationService.createInstance(ProxyAuthHandler);
|
||||
this.toDispose.push(authHandler);
|
||||
|
||||
// Post Open Windows Tasks
|
||||
appInstantiationService.invokeFunction(accessor => this.afterWindowOpen(accessor));
|
||||
// Open Windows
|
||||
appInstantiationService.invokeFunction(accessor => this.openFirstWindow(accessor));
|
||||
|
||||
// Post Open Windows Tasks
|
||||
appInstantiationService.invokeFunction(accessor => this.afterWindowOpen(accessor));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -311,6 +319,24 @@ export class CodeApplication {
|
|||
});
|
||||
}
|
||||
|
||||
private backupLocalStorage(): TPromise<void> {
|
||||
const localStorageBackedUp = this.stateService.getItem<string>(CodeApplication.LOCAL_STORAGE_BACKED_UP_KEY);
|
||||
if (localStorageBackedUp) {
|
||||
return TPromise.wrap(void 0);
|
||||
}
|
||||
|
||||
const afterBackupDone = () => {
|
||||
|
||||
// Remember in global storage
|
||||
this.stateService.setItem(CodeApplication.LOCAL_STORAGE_BACKED_UP_KEY, true);
|
||||
};
|
||||
|
||||
const localStorageFile = join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage');
|
||||
const localStorageJournalFile = join(this.environmentService.userDataPath, 'Local Storage', 'file__0.localstorage-journal');
|
||||
|
||||
return copy(localStorageFile, `${localStorageFile}.vscbak`).then(() => copy(localStorageJournalFile, `${localStorageJournalFile}.vscbak`)).then(afterBackupDone, afterBackupDone);
|
||||
}
|
||||
|
||||
private initServices(machineId: string): IInstantiationService {
|
||||
const services = new ServiceCollection();
|
||||
|
||||
|
@ -402,11 +428,12 @@ export class CodeApplication {
|
|||
this.windowsMainService.ready(this.userEnv);
|
||||
|
||||
// Open our first window
|
||||
const macOpenFiles = (<any>global).macOpenFiles as string[];
|
||||
const context = !!process.env['VSCODE_CLI'] ? OpenContext.CLI : OpenContext.DESKTOP;
|
||||
if (args['new-window'] && args._.length === 0) {
|
||||
this.windowsMainService.open({ context, cli: args, forceNewWindow: true, forceEmpty: true, initialStartup: true }); // new window if "-n" was used without paths
|
||||
} else if (global.macOpenFiles && global.macOpenFiles.length && (!args._ || !args._.length)) {
|
||||
this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, pathsToOpen: global.macOpenFiles, initialStartup: true }); // mac: open-file event received on startup
|
||||
} else if (macOpenFiles && macOpenFiles.length && (!args._ || !args._.length)) {
|
||||
this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, pathsToOpen: macOpenFiles, initialStartup: true }); // mac: open-file event received on startup
|
||||
} else {
|
||||
this.windowsMainService.open({ context, cli: args, forceNewWindow: args['new-window'] || (!args._.length && args['unity-launch']), diffMode: args.diff, initialStartup: true }); // default: read paths from cli
|
||||
}
|
||||
|
|
|
@ -151,6 +151,13 @@ function setupIPC(accessor: ServicesAccessor): TPromise<Server> {
|
|||
app.dock.show();
|
||||
}
|
||||
|
||||
// Disable the GTK3 emoji picker as it intercepts ctrl+shift+e (and
|
||||
// doesn't work)
|
||||
if (platform.isLinux) {
|
||||
process.env['GTK_IM_MODULE'] = 'gtk-im-context-simple';
|
||||
process.env['XMODIFIERS'] = '@im=none';
|
||||
}
|
||||
|
||||
// Set the VSCODE_PID variable here when we are sure we are the first
|
||||
// instance to startup. Otherwise we would wrongly overwrite the PID
|
||||
process.env['VSCODE_PID'] = String(process.pid);
|
||||
|
|
|
@ -100,7 +100,7 @@ export class CodeMenu {
|
|||
this.windowsMainService.onWindowClose(() => this.updateWorkspaceMenuItems());
|
||||
|
||||
// Listen to extension viewlets
|
||||
ipc.on('vscode:extensionViewlets', (_event: any, rawExtensionViewlets: string) => {
|
||||
ipc.on('vscode:extensionViewlets', (event: any, rawExtensionViewlets: string) => {
|
||||
let extensionViewlets: IExtensionViewlet[] = [];
|
||||
try {
|
||||
extensionViewlets = JSON.parse(rawExtensionViewlets);
|
||||
|
|
|
@ -178,23 +178,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
|
||||
}
|
||||
|
@ -598,7 +581,7 @@ export class CodeWindow implements ICodeWindow {
|
|||
|
||||
// Perf Counters
|
||||
windowConfiguration.perfEntries = exportEntries();
|
||||
windowConfiguration.perfStartTime = global.perfStartTime;
|
||||
windowConfiguration.perfStartTime = (<any>global).perfStartTime;
|
||||
windowConfiguration.perfWindowLoadTime = Date.now();
|
||||
|
||||
// Config (combination of process.argv and window configuration)
|
||||
|
@ -947,11 +930,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 }));
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ export class WindowsManager implements IWindowsMainService {
|
|||
});
|
||||
|
||||
// React to workbench loaded events from windows
|
||||
ipc.on('vscode:workbenchLoaded', (_event: any, windowId: number) => {
|
||||
ipc.on('vscode:workbenchLoaded', (event: any, windowId: number) => {
|
||||
this.logService.trace('IPC#vscode-workbenchLoaded');
|
||||
|
||||
const win = this.getWindowById(windowId);
|
||||
|
|
|
@ -192,7 +192,7 @@ export default class RenameInputField implements IContentWidget, IDisposable {
|
|||
this._inputField.setSelectionRange(
|
||||
parseInt(this._inputField.getAttribute('selectionStart')),
|
||||
parseInt(this._inputField.getAttribute('selectionEnd')));
|
||||
}, 25);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
private _hide(): void {
|
||||
|
|
|
@ -109,7 +109,7 @@ suite('Editor Model - Model', () => {
|
|||
let e: ModelRawContentChangedEvent = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail();
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
e = _e;
|
||||
});
|
||||
|
@ -128,7 +128,7 @@ suite('Editor Model - Model', () => {
|
|||
let e: ModelRawContentChangedEvent = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail();
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
e = _e;
|
||||
});
|
||||
|
@ -205,7 +205,7 @@ suite('Editor Model - Model', () => {
|
|||
let e: ModelRawContentChangedEvent = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail();
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
e = _e;
|
||||
});
|
||||
|
@ -224,7 +224,7 @@ suite('Editor Model - Model', () => {
|
|||
let e: ModelRawContentChangedEvent = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail();
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
e = _e;
|
||||
});
|
||||
|
@ -243,7 +243,7 @@ suite('Editor Model - Model', () => {
|
|||
let e: ModelRawContentChangedEvent = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail();
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
e = _e;
|
||||
});
|
||||
|
@ -263,7 +263,7 @@ suite('Editor Model - Model', () => {
|
|||
let e: ModelRawContentChangedEvent = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail();
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
e = _e;
|
||||
});
|
||||
|
@ -314,7 +314,7 @@ suite('Editor Model - Model', () => {
|
|||
let e: ModelRawContentChangedEvent = null;
|
||||
thisModel.onDidChangeRawContent((_e) => {
|
||||
if (e !== null) {
|
||||
assert.fail();
|
||||
assert.fail('Unexpected assertion error');
|
||||
}
|
||||
e = _e;
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -32,7 +32,7 @@ export class ElectronURLListener {
|
|||
@IURLService private urlService: IURLService,
|
||||
@IWindowsMainService private windowsService: IWindowsMainService
|
||||
) {
|
||||
const globalBuffer = (global.getOpenUrls() || []) as string[];
|
||||
const globalBuffer = ((<any>global).getOpenUrls() || []) as string[];
|
||||
const rawBuffer = [
|
||||
...(typeof initial === 'string' ? [initial] : initial),
|
||||
...globalBuffer
|
||||
|
|
|
@ -24,11 +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 { isMacintosh } from 'vs/base/common/platform';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
||||
export class ActivitybarPart extends Part {
|
||||
|
||||
|
@ -56,11 +60,13 @@ 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);
|
||||
|
||||
this.globalActivityIdToActions = Object.create(null);
|
||||
|
||||
this.compositeBar = this.instantiationService.createInstance(CompositeBar, {
|
||||
icon: true,
|
||||
storageId: ActivitybarPart.PINNED_VIEWLETS,
|
||||
|
@ -75,6 +81,7 @@ export class ActivitybarPart extends Part {
|
|||
colors: ActivitybarPart.COLORS,
|
||||
overflowActionSize: ActivitybarPart.ACTION_HEIGHT
|
||||
});
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
|
@ -128,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;
|
||||
}
|
||||
|
||||
|
@ -225,4 +253,4 @@ export class ActivitybarPart extends Part {
|
|||
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ process.lazyEnv = new Promise(function (resolve) {
|
|||
assign(process.env, shellEnv);
|
||||
resolve(process.env);
|
||||
});
|
||||
ipc.send('vscode:fetchShellEnv', remote.getCurrentWindow().id);
|
||||
ipc.send('vscode:fetchShellEnv');
|
||||
});
|
||||
|
||||
Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
|
||||
|
|
|
@ -294,17 +294,17 @@ export class WorkbenchShell {
|
|||
}
|
||||
|
||||
perf.mark('willReadLocalStorage');
|
||||
const readyToSend = this.storageService.getBoolean('localStorageMetricsReadyToSend2');
|
||||
const readyToSend = this.storageService.getBoolean('localStorageMetricsReadyToSend3');
|
||||
perf.mark('didReadLocalStorage');
|
||||
|
||||
if (!readyToSend) {
|
||||
this.storageService.store('localStorageMetricsReadyToSend2', true);
|
||||
this.storageService.store('localStorageMetricsReadyToSend3', true);
|
||||
return; // avoid logging localStorage metrics directly after the update, we prefer cold startup numbers
|
||||
}
|
||||
|
||||
if (!this.storageService.getBoolean('localStorageMetricsSent2')) {
|
||||
if (!this.storageService.getBoolean('localStorageMetricsSent3')) {
|
||||
perf.mark('willWriteLocalStorage');
|
||||
this.storageService.store('localStorageMetricsSent2', true);
|
||||
this.storageService.store('localStorageMetricsSent3', true);
|
||||
perf.mark('didWriteLocalStorage');
|
||||
|
||||
perf.mark('willStatLocalStorage');
|
||||
|
|
|
@ -131,7 +131,7 @@ export class ElectronWindow extends Themable {
|
|||
});
|
||||
|
||||
// Support runAction event
|
||||
ipc.on('vscode:runAction', (_event: any, request: IRunActionInWindowRequest) => {
|
||||
ipc.on('vscode:runAction', (event: any, request: IRunActionInWindowRequest) => {
|
||||
const args: any[] = [];
|
||||
|
||||
// If we run an action from the touchbar, we fill in the currently active resource
|
||||
|
@ -162,7 +162,7 @@ export class ElectronWindow extends Themable {
|
|||
});
|
||||
|
||||
// Support resolve keybindings event
|
||||
ipc.on('vscode:resolveKeybindings', (_event: any, rawActionIds: string) => {
|
||||
ipc.on('vscode:resolveKeybindings', (event: any, rawActionIds: string) => {
|
||||
let actionIds: string[] = [];
|
||||
try {
|
||||
actionIds = JSON.parse(rawActionIds);
|
||||
|
@ -178,7 +178,7 @@ export class ElectronWindow extends Themable {
|
|||
}, () => errors.onUnexpectedError);
|
||||
});
|
||||
|
||||
ipc.on('vscode:reportError', (_event: any, error: string) => {
|
||||
ipc.on('vscode:reportError', (event: any, error: string) => {
|
||||
if (error) {
|
||||
const errorParsed = JSON.parse(error);
|
||||
errorParsed.mainProcess = true;
|
||||
|
@ -187,13 +187,13 @@ export class ElectronWindow extends Themable {
|
|||
});
|
||||
|
||||
// Support openFiles event for existing and new files
|
||||
ipc.on('vscode:openFiles', (_event: any, request: IOpenFileRequest) => this.onOpenFiles(request));
|
||||
ipc.on('vscode:openFiles', (event: any, request: IOpenFileRequest) => this.onOpenFiles(request));
|
||||
|
||||
// Support addFolders event if we have a workspace opened
|
||||
ipc.on('vscode:addFolders', (_event: any, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
||||
ipc.on('vscode:addFolders', (event: any, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
||||
|
||||
// Message support
|
||||
ipc.on('vscode:showInfoMessage', (_event: any, message: string) => {
|
||||
ipc.on('vscode:showInfoMessage', (event: any, message: string) => {
|
||||
this.notificationService.info(message);
|
||||
});
|
||||
|
||||
|
@ -240,7 +240,7 @@ export class ElectronWindow extends Themable {
|
|||
});
|
||||
|
||||
// keyboard layout changed event
|
||||
ipc.on('vscode:accessibilitySupportChanged', (_event: any, accessibilitySupportEnabled: boolean) => {
|
||||
ipc.on('vscode:accessibilitySupportChanged', (event: any, accessibilitySupportEnabled: boolean) => {
|
||||
browser.setAccessibilitySupport(accessibilitySupportEnabled ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled);
|
||||
});
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@ import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
|
|||
|
||||
// const nativeExit = process.exit.bind(process);
|
||||
function patchProcess(allowExit: boolean) {
|
||||
process.exit = function (code) {
|
||||
process.exit = function (code?: number) {
|
||||
if (allowExit) {
|
||||
exit(code);
|
||||
} else {
|
||||
const err = new Error('An extension called process.exit() and this was prevented.');
|
||||
console.warn(err.stack);
|
||||
}
|
||||
};
|
||||
} as (code?: number) => never;
|
||||
|
||||
process.crash = function () {
|
||||
const err = new Error('An extension called process.crash() and this was prevented.');
|
||||
|
|
|
@ -55,12 +55,12 @@ export class NodeCachedDataManager implements IWorkbenchContribution {
|
|||
}
|
||||
*/
|
||||
this._telemetryService.publicLog('cachedDataInfo', {
|
||||
didRequestCachedData: Boolean(global.require.getConfig().nodeCachedDataDir),
|
||||
didRequestCachedData: Boolean((<any>global).require.getConfig().nodeCachedDataDir),
|
||||
didRejectCachedData,
|
||||
didProduceCachedData
|
||||
});
|
||||
|
||||
global.require.config({ onNodeCachedData: undefined });
|
||||
(<any>global).require.config({ onNodeCachedData: undefined });
|
||||
delete MonacoEnvironment.onNodeCachedData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,6 +136,6 @@ suite('Debug - Adapter', () => {
|
|||
|
||||
return adapter.getInitialConfigurationContent().then(content => {
|
||||
assert.equal(content, expected);
|
||||
}, err => assert.fail());
|
||||
}, err => assert.fail(err));
|
||||
});
|
||||
});
|
|
@ -24,7 +24,7 @@ var cols = process.env.PTYCOLS;
|
|||
var rows = process.env.PTYROWS;
|
||||
var currentTitle = '';
|
||||
|
||||
setupPlanB(process.env.PTYPID);
|
||||
setupPlanB(Number(process.env.PTYPID));
|
||||
cleanEnv();
|
||||
|
||||
interface IOptions {
|
||||
|
@ -91,9 +91,9 @@ process.on('message', function (message) {
|
|||
sendProcessId();
|
||||
setupTitlePolling();
|
||||
|
||||
function getArgs() {
|
||||
function getArgs(): string[] {
|
||||
if (process.env['PTYSHELLCMDLINE']) {
|
||||
return process.env['PTYSHELLCMDLINE'];
|
||||
return [process.env['PTYSHELLCMDLINE']];
|
||||
}
|
||||
var args = [];
|
||||
var i = 0;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -119,7 +119,7 @@ export class CrashReporterService implements ICrashReporterService {
|
|||
// Experimental crash reporting support for child processes on Mac only for now
|
||||
if (this.isEnabled && isMacintosh) {
|
||||
const childProcessOptions = deepClone(this.options);
|
||||
childProcessOptions.extra.processName = name;
|
||||
(<any>childProcessOptions.extra).processName = name;
|
||||
childProcessOptions.crashesDirectory = os.tmpdir();
|
||||
|
||||
return childProcessOptions;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -61,7 +61,7 @@ export class NsfwWatcherService implements IWatcherService {
|
|||
ignored: request.ignored
|
||||
};
|
||||
|
||||
process.on('uncaughtException', e => {
|
||||
process.on('uncaughtException', (e: Error | string) => {
|
||||
|
||||
// Specially handle ENOSPC errors that can happen when
|
||||
// the watcher consumes so many file descriptors that
|
||||
|
|
|
@ -29,7 +29,7 @@ const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.u
|
|||
export class RipgrepEngine {
|
||||
private isDone = false;
|
||||
private rgProc: cp.ChildProcess;
|
||||
private killRgProcFn: Function;
|
||||
private killRgProcFn: (code?: number) => void;
|
||||
private postProcessExclusions: glob.ParsedExpression;
|
||||
|
||||
private ripgrepParser: RipgrepParser;
|
||||
|
|
|
@ -109,7 +109,7 @@ suite('SearchService', () => {
|
|||
assert.deepStrictEqual(value, match);
|
||||
results++;
|
||||
} else {
|
||||
assert.fail(value);
|
||||
assert.fail(JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -131,7 +131,7 @@ suite('SearchService', () => {
|
|||
});
|
||||
results.push(value.length);
|
||||
} else {
|
||||
assert.fail(value);
|
||||
assert.fail(JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -218,7 +218,7 @@ suite('SearchService', () => {
|
|||
if (Array.isArray(value)) {
|
||||
results.push(...value.map(v => v.path));
|
||||
} else {
|
||||
assert.fail(value);
|
||||
assert.fail(JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -245,7 +245,7 @@ suite('SearchService', () => {
|
|||
});
|
||||
results.push(value.length);
|
||||
} else {
|
||||
assert.fail(value);
|
||||
assert.fail(JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -275,7 +275,7 @@ suite('SearchService', () => {
|
|||
if (Array.isArray(value)) {
|
||||
results.push(...value.map(v => v.path));
|
||||
} else {
|
||||
assert.fail(value);
|
||||
assert.fail(JSON.stringify(value));
|
||||
}
|
||||
}).then(() => {
|
||||
const results = [];
|
||||
|
@ -291,7 +291,7 @@ suite('SearchService', () => {
|
|||
if (Array.isArray(value)) {
|
||||
results.push(...value.map(v => v.path));
|
||||
} else {
|
||||
assert.fail(value);
|
||||
assert.fail(JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
}).then(() => {
|
||||
|
@ -316,7 +316,7 @@ suite('SearchService', () => {
|
|||
if (Array.isArray(value)) {
|
||||
results.push(...value.map(v => v.path));
|
||||
} else {
|
||||
assert.fail(value);
|
||||
assert.fail(JSON.stringify(value));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue