Skip to content

Commit da1aad9

Browse files
authored
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
1 parent c59927d commit da1aad9

20 files changed

+368
-303
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: node_js
22
node_js:
33
- 8.15.0
44
env:
5-
- VSCODE_VERSION="1.32.0" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
5+
- VSCODE_VERSION="1.33.0" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
66
matrix:
77
include:
88
- os: linux

build/tasks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const libPath = path.join(__dirname, "../lib");
1212
const vscodePath = path.join(libPath, "vscode");
1313
const defaultExtensionsPath = path.join(libPath, "extensions");
1414
const pkgsPath = path.join(__dirname, "../packages");
15-
const vscodeVersion = process.env.VSCODE_VERSION || "1.32.0";
15+
const vscodeVersion = process.env.VSCODE_VERSION || "1.33.0";
1616
const vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`;
1717

1818
const buildServerBinary = register("build:server:binary", async (runner) => {

packages/ide/src/client.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,16 @@ export abstract class IdeClient {
4141
});
4242

4343
this.sharedProcessData = new Promise((resolve): void => {
44-
client.onSharedProcessActive(resolve);
44+
let d = client.onSharedProcessActive((data) => {
45+
d.dispose();
46+
d = client.onSharedProcessActive(() => {
47+
d.dispose();
48+
this.retry.notificationService.error(
49+
new Error("Disconnected from shared process. Searching, installing, enabling, and disabling extensions will not work until the page is refreshed."),
50+
);
51+
});
52+
resolve(data);
53+
});
4554
});
4655

4756
window.addEventListener("contextmenu", (event) => {
@@ -65,17 +74,17 @@ export abstract class IdeClient {
6574
});
6675
}
6776

68-
/**
69-
* Wrap a task in some logging, timing, and progress updates. Can optionally
70-
* wait on other tasks which won't count towards this task's time.
71-
*/
7277
public async task<T>(description: string, duration: number, task: () => Promise<T>): Promise<T>;
7378
public async task<T, V>(description: string, duration: number, task: (v: V) => Promise<T>, t: Promise<V>): Promise<T>;
7479
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>;
7580
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>;
7681
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>;
7782
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>;
7883
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>;
84+
/**
85+
* Wrap a task in some logging, timing, and progress updates. Can optionally
86+
* wait on other tasks which won't count towards this task's time.
87+
*/
7988
public async task<T>(
8089
description: string, duration: number = 100, task: (...args: any[]) => Promise<T>, ...after: Array<Promise<any>> // tslint:disable-line no-any
8190
): Promise<T> {

packages/ide/src/fill/dialog.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class Dialog {
132132
public show(): void {
133133
if (!this.cachedActiveElement) {
134134
this.cachedActiveElement = document.activeElement as HTMLElement;
135-
(document.getElementById("workbench.main.container") || document.body).appendChild(this.overlay);
135+
(document.querySelector(".monaco-workbench") || document.body).appendChild(this.overlay);
136136
document.addEventListener("keydown", this.onKeydown);
137137
if (this.input) {
138138
this.input.focus();

packages/ide/src/fill/electron.ts

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

packages/ide/src/fill/webview.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!DOCTYPE html>
2+
<html lang="en" style="width: 100%; height: 100%">
3+
<head>
4+
<title>Virtual Document</title>
5+
</head>
6+
<body style="margin: 0; overflow: hidden; width: 100%; height: 100%">
7+
</body>
8+
</html>

packages/ide/src/retry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class Retry {
147147
*
148148
* Blocking without a name will override a block with a name.
149149
*/
150-
private block(name?: string): void {
150+
public block(name?: string): void {
151151
if (!this.blocked || !name) {
152152
this.blocked = name || true;
153153
this.items.forEach((item) => {

packages/protocol/src/browser/modules/spdlog.ts

+8
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,12 @@ export class SpdlogModule {
4545
public setAsyncMode = (bufferSize: number, flushInterval: number): Promise<void> => {
4646
return this.proxy.setAsyncMode(bufferSize, flushInterval);
4747
}
48+
49+
public createRotatingLogger(name: string, filename: string, filesize: number, filecount: number): RotatingLogger {
50+
return new RotatingLogger(this.proxy, name, filename, filesize, filecount);
51+
}
52+
53+
public createRotatingLoggerAsync(name: string, filename: string, filesize: number, filecount: number): Promise<RotatingLogger> {
54+
return Promise.resolve(this.createRotatingLogger(name, filename, filesize, filecount));
55+
}
4856
}

packages/protocol/src/common/proxy.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ export abstract class ClientProxy<T extends ServerProxy> extends EventEmitter {
5353
}
5454
}
5555

56+
/**
57+
* Remove an event listener.
58+
*/
59+
public off(event: string, cb: (...args: any[]) => void): this {
60+
// Fill it here because the fill we're using to provide EventEmitter for the
61+
// browser doesn't appear to include `off`.
62+
this.removeListener(event, cb);
63+
64+
return this;
65+
}
66+
5667
protected get proxy(): T {
5768
if (!this._proxy) {
5869
throw new Error("not initialized");
@@ -158,8 +169,10 @@ export abstract class Batch<T, A> {
158169
private readonly maxCount: number = 100,
159170
/**
160171
* Flush after not receiving more requests for this amount of time.
172+
* This is pretty low by default so essentially we just end up batching
173+
* requests that are all made at the same time.
161174
*/
162-
private readonly idleTime: number = 100,
175+
private readonly idleTime: number = 1,
163176
) {}
164177

165178
public add = (args: A): Promise<T> => {

packages/protocol/test/net.test.ts

+17
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ describe("net", () => {
3838
expect(fn).toHaveBeenCalledTimes(1);
3939
});
4040

41+
it("should remove event listener", async () => {
42+
const socket = new net.Socket();
43+
44+
const fn1 = jest.fn();
45+
const fn2 = jest.fn();
46+
47+
socket.on("error", fn1);
48+
socket.on("error", fn2);
49+
socket.off("error", fn1);
50+
51+
socket.connect("/tmp/t/e/s/t/d/o/e/s/n/o/t/e/x/i/s/t");
52+
53+
await new Promise((r): nativeNet.Socket => socket.on("close", r));
54+
expect(fn1).toHaveBeenCalledTimes(0);
55+
expect(fn2).toHaveBeenCalledTimes(1);
56+
});
57+
4158
it("should connect", async () => {
4259
await new Promise((resolve): void => {
4360
const socket = net.createConnection(socketPath, () => {

packages/server/src/vscode/sharedProcess.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ export class SharedProcess {
6666
this.setState({ state: SharedProcessState.Starting });
6767
const activeProcess = await this.restart();
6868

69-
activeProcess.stderr.on("data", (data) => {
70-
// Warn instead of error to prevent panic. It's unlikely stderr here is
71-
// about anything critical to the functioning of the editor.
72-
logger.warn(data.toString());
73-
});
74-
7569
activeProcess.on("exit", (exitCode) => {
7670
const error = new Error(`Exited with ${exitCode}`);
7771
this.setState({
@@ -132,6 +126,16 @@ export class SharedProcess {
132126
activeProcess.on("error", doReject);
133127
activeProcess.on("exit", doReject);
134128

129+
activeProcess.stdout.on("data", (data) => {
130+
logger.trace(data.toString());
131+
});
132+
133+
activeProcess.stderr.on("data", (data) => {
134+
// Warn instead of error to prevent panic. It's unlikely stderr here is
135+
// about anything critical to the functioning of the editor.
136+
logger.warn(data.toString());
137+
});
138+
135139
this.ipcHandler = new StdioIpcHandler(activeProcess);
136140
this.ipcHandler.once("handshake:hello", () => {
137141
const data: {

packages/vscode/src/dialog.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Dialog {
108108
this.root.style.width = "850px";
109109
this.root.style.height = "600px";
110110
this.background.appendChild(this.root);
111-
(document.getElementById("workbench.main.container") || document.body).appendChild(this.background);
111+
(document.querySelector(".monaco-workbench") || document.body).appendChild(this.background);
112112
this.root.classList.add("dialog");
113113

114114
const setProperty = (vari: string, id: string): void => {

packages/vscode/src/fill/paste.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as nls from "vs/nls";
22
import { Action } from "vs/base/common/actions";
33
import { TERMINAL_COMMAND_ID } from "vs/workbench/contrib/terminal/common/terminalCommands";
44
import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal";
5-
import * as actions from "vs/workbench/contrib/terminal/electron-browser/terminalActions";
6-
import * as instance from "vs/workbench/contrib/terminal/electron-browser/terminalInstance";
5+
import * as actions from "vs/workbench/contrib/terminal/browser/terminalActions";
6+
import * as instance from "vs/workbench/contrib/terminal/browser/terminalInstance";
77
import { client } from "../client";
88

99
const getLabel = (key: string, enabled: boolean): string => {

packages/vscode/src/fill/windowsService.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as electron from "electron";
22
import { Emitter } from "@coder/events";
3-
import * as windowsIpc from "vs/platform/windows/node/windowsIpc";
43
import { IWindowsService, INativeOpenDialogOptions, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, IMessageBoxResult, IDevToolsOptions, IEnterWorkspaceResult, CrashReporterStartOptions, INewWindowOptions, IOpenFileRequest, IAddFoldersRequest } from "vs/platform/windows/common/windows";
54
import { ParsedArgs } from "vs/platform/environment/common/environment";
65
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces";
@@ -15,7 +14,7 @@ import { workbench } from "../workbench";
1514
* Instead of going to the shared process, we'll directly run these methods on
1615
* the client. This setup means we can only control the current window.
1716
*/
18-
class WindowsService implements IWindowsService {
17+
export class WindowsService implements IWindowsService {
1918
// tslint:disable-next-line no-any
2019
public _serviceBrand: any;
2120

@@ -343,7 +342,3 @@ class WindowsService implements IWindowsService {
343342
return this.window;
344343
}
345344
}
346-
347-
const target = windowsIpc as typeof windowsIpc;
348-
// @ts-ignore TODO: don't ignore it.
349-
target.WindowsChannelClient = WindowsService;

packages/vscode/src/fill/workbenchRegistry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { IWorkbenchActionRegistry, Extensions } from "vs/workbench/common/action
55
import { SyncActionDescriptor } from "vs/platform/actions/common/actions";
66
import { ContextKeyExpr } from "vs/platform/contextkey/common/contextkey";
77
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions";
8-
import { TerminalPasteAction } from "vs/workbench/contrib/terminal/electron-browser/terminalActions";
8+
import { TerminalPasteAction } from "vs/workbench/contrib/terminal/browser/terminalActions";
99
import { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/contrib/terminal/common/terminal";
1010
import { KeyCode, KeyMod } from "vs/base/common/keyCodes";
1111
import { workbench } from "../workbench";

packages/vscode/src/workbench.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ export class Workbench {
139139
logger.error(error.message);
140140
});
141141

142+
const contextKeys = this.serviceCollection.get(IContextKeyService) as IContextKeyService;
143+
const bounded = this.clipboardContextKey.bindTo(contextKeys);
144+
client.clipboard.onPermissionChange((enabled) => {
145+
bounded.set(enabled);
146+
});
147+
client.clipboard.initialize();
148+
142149
client.progressService = {
143150
start: <T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T> => {
144151
let lastProgress = 0;
@@ -237,12 +244,6 @@ export class Workbench {
237244
return;
238245
}
239246
}
240-
const contextKeys = this.serviceCollection.get(IContextKeyService) as IContextKeyService;
241-
const bounded = this.clipboardContextKey.bindTo(contextKeys);
242-
client.clipboard.onPermissionChange((enabled) => {
243-
bounded.set(enabled);
244-
});
245-
client.clipboard.initialize();
246247
}
247248
}
248249

packages/vscode/webpack.bootstrap.config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ module.exports = merge(
3636
loader: "ignore-loader",
3737
}],
3838
}, {
39-
test: /((\\|\/)vs(\\|\/)code(\\|\/)electron-main(\\|\/))|((\\|\/)test(\\|\/))|(OSSREADME\.json$)|\/browser\//,
39+
// The only thing we need in electron-browser is the shared process (including contrib).
40+
test: /((\\|\/)vs(\\|\/)code(\\|\/)electron-main(\\|\/))|((\\|\/)test(\\|\/))|(OSSREADME\.json$)|\/browser\/|\/electron-browser\/(?!sharedProcess\/).+\//,
4041
use: [{
4142
loader: "ignore-loader",
4243
}],
@@ -50,6 +51,7 @@ module.exports = merge(
5051
"windows-mutex": path.resolve(fills, "empty.ts"),
5152
"windows-process-tree": path.resolve(fills, "empty.ts"),
5253
"vscode-windows-registry": path.resolve(fills, "empty.ts"),
54+
"vscode-windows-ca-certs": path.resolve(fills, "empty.ts"),
5355
"vscode-sqlite3": path.resolve(fills, "empty.ts"),
5456
"vs/base/browser/browser": path.resolve(fills, "empty.ts"),
5557

packages/web/webpack.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ module.exports = merge(
7070
// This seems to be in the wrong place?
7171
"vs/workbench/contrib/codeEditor/electron-browser/media/WordWrap_16x.svg": "vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/WordWrap_16x.svg",
7272

73+
"vs/platform/windows/electron-browser/windowsService": path.join(vsFills, "windowsService.ts"),
7374
"vs/base/node/paths": path.join(vsFills, "paths.ts"),
7475
"vs/base/common/amd": path.join(vsFills, "amd.ts"),
7576
"vs/platform/product/node/package": path.resolve(vsFills, "package.ts"),

0 commit comments

Comments
 (0)