Skip to content

Update VS Code to 1.33.0 #445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ language: node_js
node_js:
- 8.15.0
env:
- VSCODE_VERSION="1.32.0" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
- VSCODE_VERSION="1.33.0" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
matrix:
include:
- os: linux
2 changes: 1 addition & 1 deletion build/tasks.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ const libPath = path.join(__dirname, "../lib");
const vscodePath = path.join(libPath, "vscode");
const defaultExtensionsPath = path.join(libPath, "extensions");
const pkgsPath = path.join(__dirname, "../packages");
const vscodeVersion = process.env.VSCODE_VERSION || "1.32.0";
const vscodeVersion = process.env.VSCODE_VERSION || "1.33.0";
const vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`;

const buildServerBinary = register("build:server:binary", async (runner) => {
19 changes: 14 additions & 5 deletions packages/ide/src/client.ts
Original file line number Diff line number Diff line change
@@ -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,17 +74,17 @@ 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>;
public async task<T, V1, V2, V3>(description: string, duration: number, task: (v1: V1, v2: V2, v3: V3) => Promise<T>, t1: Promise<V1>, t2: Promise<V2>, t3: Promise<V3>): Promise<T>;
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> {
2 changes: 1 addition & 1 deletion packages/ide/src/fill/dialog.ts
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 4 additions & 0 deletions packages/ide/src/fill/electron.ts
Original file line number Diff line number Diff line change
@@ -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) {
8 changes: 8 additions & 0 deletions packages/ide/src/fill/webview.html
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion packages/ide/src/retry.ts
Original file line number Diff line number Diff line change
@@ -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) => {
8 changes: 8 additions & 0 deletions packages/protocol/src/browser/modules/spdlog.ts
Original file line number Diff line number Diff line change
@@ -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));
}
}
15 changes: 14 additions & 1 deletion packages/protocol/src/common/proxy.ts
Original file line number Diff line number Diff line change
@@ -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> => {
17 changes: 17 additions & 0 deletions packages/protocol/test/net.test.ts
Original file line number Diff line number Diff line change
@@ -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, () => {
16 changes: 10 additions & 6 deletions packages/server/src/vscode/sharedProcess.ts
Original file line number Diff line number Diff line change
@@ -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: {
2 changes: 1 addition & 1 deletion packages/vscode/src/dialog.ts
Original file line number Diff line number Diff line change
@@ -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 => {
4 changes: 2 additions & 2 deletions packages/vscode/src/fill/paste.ts
Original file line number Diff line number Diff line change
@@ -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 => {
7 changes: 1 addition & 6 deletions packages/vscode/src/fill/windowsService.ts
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion packages/vscode/src/fill/workbenchRegistry.ts
Original file line number Diff line number Diff line change
@@ -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";
13 changes: 7 additions & 6 deletions packages/vscode/src/workbench.ts
Original file line number Diff line number Diff line change
@@ -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();
}
}

4 changes: 3 additions & 1 deletion packages/vscode/webpack.bootstrap.config.js
Original file line number Diff line number Diff line change
@@ -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"),

1 change: 1 addition & 0 deletions packages/web/webpack.config.js
Original file line number Diff line number Diff line change
@@ -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"),
541 changes: 272 additions & 269 deletions scripts/vscode.patch

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/vstar.sh
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ set -euxo pipefail
# Builds a tarfile containing vscode sourcefiles neccessary for CI.
# Done outside the CI and uploaded to object storage to reduce CI time.

branch=1.32.0
branch=1.33.0
dir=/tmp/vstar
outfile=/tmp/vstar-$branch.tar.gz
rm -rf $dir