Skip to content

Commit a1136b3

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 4dd74b3 commit a1136b3

File tree

20 files changed

+368
-303
lines changed

20 files changed

+368
-303
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 14 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 14 additions & 1 deletion
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

Lines changed: 17 additions & 0 deletions
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, () => {

0 commit comments

Comments
 (0)