Archived
1
0

Update VS Code to 1.33.0 (#445)

* Update VS Code to 1.33.0

* Fix slow file tree

* Fix WindowsService fill

* Provide `off` on event listeners

* Fix webview

* Fix double title bar and missing preferences on Mac

* Bump VS Code version in Travis config

* Fix black dialog text (again)

* Fix shared process not starting
This commit is contained in:
Asher
2019-04-05 18:49:29 -05:00
committed by GitHub
parent 4dd74b31b9
commit a1136b3a02
20 changed files with 368 additions and 303 deletions

View File

@ -41,7 +41,16 @@ export abstract class IdeClient {
});
this.sharedProcessData = new Promise((resolve): void => {
client.onSharedProcessActive(resolve);
let d = client.onSharedProcessActive((data) => {
d.dispose();
d = client.onSharedProcessActive(() => {
d.dispose();
this.retry.notificationService.error(
new Error("Disconnected from shared process. Searching, installing, enabling, and disabling extensions will not work until the page is refreshed."),
);
});
resolve(data);
});
});
window.addEventListener("contextmenu", (event) => {
@ -65,10 +74,6 @@ export abstract class IdeClient {
});
}
/**
* Wrap a task in some logging, timing, and progress updates. Can optionally
* wait on other tasks which won't count towards this task's time.
*/
public async task<T>(description: string, duration: number, task: () => Promise<T>): Promise<T>;
public async task<T, V>(description: string, duration: number, task: (v: V) => Promise<T>, t: Promise<V>): Promise<T>;
public async task<T, V1, V2>(description: string, duration: number, task: (v1: V1, v2: V2) => Promise<T>, t1: Promise<V1>, t2: Promise<V2>): Promise<T>;
@ -76,6 +81,10 @@ export abstract class IdeClient {
public async task<T, V1, V2, V3, V4>(description: string, duration: number, task: (v1: V1, v2: V2, v3: V3, v4: V4) => Promise<T>, t1: Promise<V1>, t2: Promise<V2>, t3: Promise<V3>, t4: Promise<V4>): Promise<T>;
public async task<T, V1, V2, V3, V4, V5>(description: string, duration: number, task: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5) => Promise<T>, t1: Promise<V1>, t2: Promise<V2>, t3: Promise<V3>, t4: Promise<V4>, t5: Promise<V5>): Promise<T>;
public async task<T, V1, V2, V3, V4, V5, V6>(description: string, duration: number, task: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6) => Promise<T>, t1: Promise<V1>, t2: Promise<V2>, t3: Promise<V3>, t4: Promise<V4>, t5: Promise<V5>, t6: Promise<V6>): Promise<T>;
/**
* Wrap a task in some logging, timing, and progress updates. Can optionally
* wait on other tasks which won't count towards this task's time.
*/
public async task<T>(
description: string, duration: number = 100, task: (...args: any[]) => Promise<T>, ...after: Array<Promise<any>> // tslint:disable-line no-any
): Promise<T> {

View File

@ -132,7 +132,7 @@ export class Dialog {
public show(): void {
if (!this.cachedActiveElement) {
this.cachedActiveElement = document.activeElement as HTMLElement;
(document.getElementById("workbench.main.container") || document.body).appendChild(this.overlay);
(document.querySelector(".monaco-workbench") || document.body).appendChild(this.overlay);
document.addEventListener("keydown", this.onKeydown);
if (this.input) {
this.input.focus();

View File

@ -137,6 +137,10 @@ const newCreateElement = <K extends keyof HTMLElementTagNameMap>(tagName: K): HT
};
},
});
view.src = require("!!file-loader?name=[path][name].[ext]!./webview.html");
Object.defineProperty(view, "src", {
set: (): void => { /* Nope. */ },
});
(view as any).getWebContents = (): void => undefined; // tslint:disable-line no-any
(view as any).send = (channel: string, ...args: any[]): void => { // tslint:disable-line no-any
if (args[0] && typeof args[0] === "object" && args[0].contents) {

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html lang="en" style="width: 100%; height: 100%">
<head>
<title>Virtual Document</title>
</head>
<body style="margin: 0; overflow: hidden; width: 100%; height: 100%">
</body>
</html>

View File

@ -147,7 +147,7 @@ export class Retry {
*
* Blocking without a name will override a block with a name.
*/
private block(name?: string): void {
public block(name?: string): void {
if (!this.blocked || !name) {
this.blocked = name || true;
this.items.forEach((item) => {

View File

@ -45,4 +45,12 @@ export class SpdlogModule {
public setAsyncMode = (bufferSize: number, flushInterval: number): Promise<void> => {
return this.proxy.setAsyncMode(bufferSize, flushInterval);
}
public createRotatingLogger(name: string, filename: string, filesize: number, filecount: number): RotatingLogger {
return new RotatingLogger(this.proxy, name, filename, filesize, filecount);
}
public createRotatingLoggerAsync(name: string, filename: string, filesize: number, filecount: number): Promise<RotatingLogger> {
return Promise.resolve(this.createRotatingLogger(name, filename, filesize, filecount));
}
}

View File

@ -53,6 +53,17 @@ export abstract class ClientProxy<T extends ServerProxy> extends EventEmitter {
}
}
/**
* Remove an event listener.
*/
public off(event: string, cb: (...args: any[]) => void): this {
// Fill it here because the fill we're using to provide EventEmitter for the
// browser doesn't appear to include `off`.
this.removeListener(event, cb);
return this;
}
protected get proxy(): T {
if (!this._proxy) {
throw new Error("not initialized");
@ -158,8 +169,10 @@ export abstract class Batch<T, A> {
private readonly maxCount: number = 100,
/**
* Flush after not receiving more requests for this amount of time.
* This is pretty low by default so essentially we just end up batching
* requests that are all made at the same time.
*/
private readonly idleTime: number = 100,
private readonly idleTime: number = 1,
) {}
public add = (args: A): Promise<T> => {

View File

@ -38,6 +38,23 @@ describe("net", () => {
expect(fn).toHaveBeenCalledTimes(1);
});
it("should remove event listener", async () => {
const socket = new net.Socket();
const fn1 = jest.fn();
const fn2 = jest.fn();
socket.on("error", fn1);
socket.on("error", fn2);
socket.off("error", fn1);
socket.connect("/tmp/t/e/s/t/d/o/e/s/n/o/t/e/x/i/s/t");
await new Promise((r): nativeNet.Socket => socket.on("close", r));
expect(fn1).toHaveBeenCalledTimes(0);
expect(fn2).toHaveBeenCalledTimes(1);
});
it("should connect", async () => {
await new Promise((resolve): void => {
const socket = net.createConnection(socketPath, () => {

View File

@ -66,12 +66,6 @@ export class SharedProcess {
this.setState({ state: SharedProcessState.Starting });
const activeProcess = await this.restart();
activeProcess.stderr.on("data", (data) => {
// Warn instead of error to prevent panic. It's unlikely stderr here is
// about anything critical to the functioning of the editor.
logger.warn(data.toString());
});
activeProcess.on("exit", (exitCode) => {
const error = new Error(`Exited with ${exitCode}`);
this.setState({
@ -132,6 +126,16 @@ export class SharedProcess {
activeProcess.on("error", doReject);
activeProcess.on("exit", doReject);
activeProcess.stdout.on("data", (data) => {
logger.trace(data.toString());
});
activeProcess.stderr.on("data", (data) => {
// Warn instead of error to prevent panic. It's unlikely stderr here is
// about anything critical to the functioning of the editor.
logger.warn(data.toString());
});
this.ipcHandler = new StdioIpcHandler(activeProcess);
this.ipcHandler.once("handshake:hello", () => {
const data: {

View File

@ -108,7 +108,7 @@ class Dialog {
this.root.style.width = "850px";
this.root.style.height = "600px";
this.background.appendChild(this.root);
(document.getElementById("workbench.main.container") || document.body).appendChild(this.background);
(document.querySelector(".monaco-workbench") || document.body).appendChild(this.background);
this.root.classList.add("dialog");
const setProperty = (vari: string, id: string): void => {

View File

@ -2,8 +2,8 @@ import * as nls from "vs/nls";
import { Action } from "vs/base/common/actions";
import { TERMINAL_COMMAND_ID } from "vs/workbench/contrib/terminal/common/terminalCommands";
import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal";
import * as actions from "vs/workbench/contrib/terminal/electron-browser/terminalActions";
import * as instance from "vs/workbench/contrib/terminal/electron-browser/terminalInstance";
import * as actions from "vs/workbench/contrib/terminal/browser/terminalActions";
import * as instance from "vs/workbench/contrib/terminal/browser/terminalInstance";
import { client } from "../client";
const getLabel = (key: string, enabled: boolean): string => {

View File

@ -1,6 +1,5 @@
import * as electron from "electron";
import { Emitter } from "@coder/events";
import * as windowsIpc from "vs/platform/windows/node/windowsIpc";
import { IWindowsService, INativeOpenDialogOptions, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, IMessageBoxResult, IDevToolsOptions, IEnterWorkspaceResult, CrashReporterStartOptions, INewWindowOptions, IOpenFileRequest, IAddFoldersRequest } from "vs/platform/windows/common/windows";
import { ParsedArgs } from "vs/platform/environment/common/environment";
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces";
@ -15,7 +14,7 @@ import { workbench } from "../workbench";
* Instead of going to the shared process, we'll directly run these methods on
* the client. This setup means we can only control the current window.
*/
class WindowsService implements IWindowsService {
export class WindowsService implements IWindowsService {
// tslint:disable-next-line no-any
public _serviceBrand: any;
@ -343,7 +342,3 @@ class WindowsService implements IWindowsService {
return this.window;
}
}
const target = windowsIpc as typeof windowsIpc;
// @ts-ignore TODO: don't ignore it.
target.WindowsChannelClient = WindowsService;

View File

@ -5,7 +5,7 @@ import { IWorkbenchActionRegistry, Extensions } from "vs/workbench/common/action
import { SyncActionDescriptor } from "vs/platform/actions/common/actions";
import { ContextKeyExpr } from "vs/platform/contextkey/common/contextkey";
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions";
import { TerminalPasteAction } from "vs/workbench/contrib/terminal/electron-browser/terminalActions";
import { TerminalPasteAction } from "vs/workbench/contrib/terminal/browser/terminalActions";
import { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/contrib/terminal/common/terminal";
import { KeyCode, KeyMod } from "vs/base/common/keyCodes";
import { workbench } from "../workbench";

View File

@ -139,6 +139,13 @@ export class Workbench {
logger.error(error.message);
});
const contextKeys = this.serviceCollection.get(IContextKeyService) as IContextKeyService;
const bounded = this.clipboardContextKey.bindTo(contextKeys);
client.clipboard.onPermissionChange((enabled) => {
bounded.set(enabled);
});
client.clipboard.initialize();
client.progressService = {
start: <T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T> => {
let lastProgress = 0;
@ -237,12 +244,6 @@ export class Workbench {
return;
}
}
const contextKeys = this.serviceCollection.get(IContextKeyService) as IContextKeyService;
const bounded = this.clipboardContextKey.bindTo(contextKeys);
client.clipboard.onPermissionChange((enabled) => {
bounded.set(enabled);
});
client.clipboard.initialize();
}
}

View File

@ -36,7 +36,8 @@ module.exports = merge(
loader: "ignore-loader",
}],
}, {
test: /((\\|\/)vs(\\|\/)code(\\|\/)electron-main(\\|\/))|((\\|\/)test(\\|\/))|(OSSREADME\.json$)|\/browser\//,
// The only thing we need in electron-browser is the shared process (including contrib).
test: /((\\|\/)vs(\\|\/)code(\\|\/)electron-main(\\|\/))|((\\|\/)test(\\|\/))|(OSSREADME\.json$)|\/browser\/|\/electron-browser\/(?!sharedProcess\/).+\//,
use: [{
loader: "ignore-loader",
}],
@ -50,6 +51,7 @@ module.exports = merge(
"windows-mutex": path.resolve(fills, "empty.ts"),
"windows-process-tree": path.resolve(fills, "empty.ts"),
"vscode-windows-registry": path.resolve(fills, "empty.ts"),
"vscode-windows-ca-certs": path.resolve(fills, "empty.ts"),
"vscode-sqlite3": path.resolve(fills, "empty.ts"),
"vs/base/browser/browser": path.resolve(fills, "empty.ts"),

View File

@ -70,6 +70,7 @@ module.exports = merge(
// This seems to be in the wrong place?
"vs/workbench/contrib/codeEditor/electron-browser/media/WordWrap_16x.svg": "vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/WordWrap_16x.svg",
"vs/platform/windows/electron-browser/windowsService": path.join(vsFills, "windowsService.ts"),
"vs/base/node/paths": path.join(vsFills, "paths.ts"),
"vs/base/common/amd": path.join(vsFills, "amd.ts"),
"vs/platform/product/node/package": path.resolve(vsFills, "package.ts"),