未验证 提交 a1136b3a 编写于 作者: A Asher 提交者: GitHub

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
上级 4dd74b31
...@@ -2,7 +2,7 @@ language: node_js ...@@ -2,7 +2,7 @@ language: node_js
node_js: node_js:
- 8.15.0 - 8.15.0
env: 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: matrix:
include: include:
- os: linux - os: linux
......
...@@ -12,7 +12,7 @@ const libPath = path.join(__dirname, "../lib"); ...@@ -12,7 +12,7 @@ const libPath = path.join(__dirname, "../lib");
const vscodePath = path.join(libPath, "vscode"); const vscodePath = path.join(libPath, "vscode");
const defaultExtensionsPath = path.join(libPath, "extensions"); const defaultExtensionsPath = path.join(libPath, "extensions");
const pkgsPath = path.join(__dirname, "../packages"); 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 vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`;
const buildServerBinary = register("build:server:binary", async (runner) => { const buildServerBinary = register("build:server:binary", async (runner) => {
......
...@@ -41,7 +41,16 @@ export abstract class IdeClient { ...@@ -41,7 +41,16 @@ export abstract class IdeClient {
}); });
this.sharedProcessData = new Promise((resolve): void => { 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) => { window.addEventListener("contextmenu", (event) => {
...@@ -65,10 +74,6 @@ export abstract class IdeClient { ...@@ -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>(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, 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>(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 { ...@@ -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>(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>(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>; 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>( public async task<T>(
description: string, duration: number = 100, task: (...args: any[]) => Promise<T>, ...after: Array<Promise<any>> // tslint:disable-line no-any description: string, duration: number = 100, task: (...args: any[]) => Promise<T>, ...after: Array<Promise<any>> // tslint:disable-line no-any
): Promise<T> { ): Promise<T> {
......
...@@ -132,7 +132,7 @@ export class Dialog { ...@@ -132,7 +132,7 @@ export class Dialog {
public show(): void { public show(): void {
if (!this.cachedActiveElement) { if (!this.cachedActiveElement) {
this.cachedActiveElement = document.activeElement as HTMLElement; 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); document.addEventListener("keydown", this.onKeydown);
if (this.input) { if (this.input) {
this.input.focus(); this.input.focus();
......
...@@ -137,6 +137,10 @@ const newCreateElement = <K extends keyof HTMLElementTagNameMap>(tagName: K): HT ...@@ -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).getWebContents = (): void => undefined; // tslint:disable-line no-any
(view as any).send = (channel: string, ...args: any[]): void => { // 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) { if (args[0] && typeof args[0] === "object" && args[0].contents) {
......
<!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>
...@@ -147,7 +147,7 @@ export class Retry { ...@@ -147,7 +147,7 @@ export class Retry {
* *
* Blocking without a name will override a block with a name. * 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) { if (!this.blocked || !name) {
this.blocked = name || true; this.blocked = name || true;
this.items.forEach((item) => { this.items.forEach((item) => {
......
...@@ -45,4 +45,12 @@ export class SpdlogModule { ...@@ -45,4 +45,12 @@ export class SpdlogModule {
public setAsyncMode = (bufferSize: number, flushInterval: number): Promise<void> => { public setAsyncMode = (bufferSize: number, flushInterval: number): Promise<void> => {
return this.proxy.setAsyncMode(bufferSize, flushInterval); 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));
}
} }
...@@ -53,6 +53,17 @@ export abstract class ClientProxy<T extends ServerProxy> extends EventEmitter { ...@@ -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 { protected get proxy(): T {
if (!this._proxy) { if (!this._proxy) {
throw new Error("not initialized"); throw new Error("not initialized");
...@@ -158,8 +169,10 @@ export abstract class Batch<T, A> { ...@@ -158,8 +169,10 @@ export abstract class Batch<T, A> {
private readonly maxCount: number = 100, private readonly maxCount: number = 100,
/** /**
* Flush after not receiving more requests for this amount of time. * 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> => { public add = (args: A): Promise<T> => {
......
...@@ -38,6 +38,23 @@ describe("net", () => { ...@@ -38,6 +38,23 @@ describe("net", () => {
expect(fn).toHaveBeenCalledTimes(1); 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 () => { it("should connect", async () => {
await new Promise((resolve): void => { await new Promise((resolve): void => {
const socket = net.createConnection(socketPath, () => { const socket = net.createConnection(socketPath, () => {
......
...@@ -66,12 +66,6 @@ export class SharedProcess { ...@@ -66,12 +66,6 @@ export class SharedProcess {
this.setState({ state: SharedProcessState.Starting }); this.setState({ state: SharedProcessState.Starting });
const activeProcess = await this.restart(); 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) => { activeProcess.on("exit", (exitCode) => {
const error = new Error(`Exited with ${exitCode}`); const error = new Error(`Exited with ${exitCode}`);
this.setState({ this.setState({
...@@ -132,6 +126,16 @@ export class SharedProcess { ...@@ -132,6 +126,16 @@ export class SharedProcess {
activeProcess.on("error", doReject); activeProcess.on("error", doReject);
activeProcess.on("exit", 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 = new StdioIpcHandler(activeProcess);
this.ipcHandler.once("handshake:hello", () => { this.ipcHandler.once("handshake:hello", () => {
const data: { const data: {
......
...@@ -108,7 +108,7 @@ class Dialog { ...@@ -108,7 +108,7 @@ class Dialog {
this.root.style.width = "850px"; this.root.style.width = "850px";
this.root.style.height = "600px"; this.root.style.height = "600px";
this.background.appendChild(this.root); 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"); this.root.classList.add("dialog");
const setProperty = (vari: string, id: string): void => { const setProperty = (vari: string, id: string): void => {
......
...@@ -2,8 +2,8 @@ import * as nls from "vs/nls"; ...@@ -2,8 +2,8 @@ import * as nls from "vs/nls";
import { Action } from "vs/base/common/actions"; import { Action } from "vs/base/common/actions";
import { TERMINAL_COMMAND_ID } from "vs/workbench/contrib/terminal/common/terminalCommands"; import { TERMINAL_COMMAND_ID } from "vs/workbench/contrib/terminal/common/terminalCommands";
import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal"; import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal";
import * as actions from "vs/workbench/contrib/terminal/electron-browser/terminalActions"; import * as actions from "vs/workbench/contrib/terminal/browser/terminalActions";
import * as instance from "vs/workbench/contrib/terminal/electron-browser/terminalInstance"; import * as instance from "vs/workbench/contrib/terminal/browser/terminalInstance";
import { client } from "../client"; import { client } from "../client";
const getLabel = (key: string, enabled: boolean): string => { const getLabel = (key: string, enabled: boolean): string => {
......
import * as electron from "electron"; import * as electron from "electron";
import { Emitter } from "@coder/events"; 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 { 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 { ParsedArgs } from "vs/platform/environment/common/environment";
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces"; import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces";
...@@ -15,7 +14,7 @@ import { workbench } from "../workbench"; ...@@ -15,7 +14,7 @@ import { workbench } from "../workbench";
* Instead of going to the shared process, we'll directly run these methods on * 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. * 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 // tslint:disable-next-line no-any
public _serviceBrand: any; public _serviceBrand: any;
...@@ -343,7 +342,3 @@ class WindowsService implements IWindowsService { ...@@ -343,7 +342,3 @@ class WindowsService implements IWindowsService {
return this.window; return this.window;
} }
} }
const target = windowsIpc as typeof windowsIpc;
// @ts-ignore TODO: don't ignore it.
target.WindowsChannelClient = WindowsService;
...@@ -5,7 +5,7 @@ import { IWorkbenchActionRegistry, Extensions } from "vs/workbench/common/action ...@@ -5,7 +5,7 @@ import { IWorkbenchActionRegistry, Extensions } from "vs/workbench/common/action
import { SyncActionDescriptor } from "vs/platform/actions/common/actions"; import { SyncActionDescriptor } from "vs/platform/actions/common/actions";
import { ContextKeyExpr } from "vs/platform/contextkey/common/contextkey"; import { ContextKeyExpr } from "vs/platform/contextkey/common/contextkey";
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions"; 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 { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/contrib/terminal/common/terminal";
import { KeyCode, KeyMod } from "vs/base/common/keyCodes"; import { KeyCode, KeyMod } from "vs/base/common/keyCodes";
import { workbench } from "../workbench"; import { workbench } from "../workbench";
......
...@@ -139,6 +139,13 @@ export class Workbench { ...@@ -139,6 +139,13 @@ export class Workbench {
logger.error(error.message); 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 = { client.progressService = {
start: <T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T> => { start: <T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T> => {
let lastProgress = 0; let lastProgress = 0;
...@@ -237,12 +244,6 @@ export class Workbench { ...@@ -237,12 +244,6 @@ export class Workbench {
return; 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();
} }
} }
......
...@@ -36,7 +36,8 @@ module.exports = merge( ...@@ -36,7 +36,8 @@ module.exports = merge(
loader: "ignore-loader", 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: [{ use: [{
loader: "ignore-loader", loader: "ignore-loader",
}], }],
...@@ -50,6 +51,7 @@ module.exports = merge( ...@@ -50,6 +51,7 @@ module.exports = merge(
"windows-mutex": path.resolve(fills, "empty.ts"), "windows-mutex": path.resolve(fills, "empty.ts"),
"windows-process-tree": path.resolve(fills, "empty.ts"), "windows-process-tree": path.resolve(fills, "empty.ts"),
"vscode-windows-registry": 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"), "vscode-sqlite3": path.resolve(fills, "empty.ts"),
"vs/base/browser/browser": path.resolve(fills, "empty.ts"), "vs/base/browser/browser": path.resolve(fills, "empty.ts"),
......
...@@ -70,6 +70,7 @@ module.exports = merge( ...@@ -70,6 +70,7 @@ module.exports = merge(
// This seems to be in the wrong place? // 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/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/node/paths": path.join(vsFills, "paths.ts"),
"vs/base/common/amd": path.join(vsFills, "amd.ts"), "vs/base/common/amd": path.join(vsFills, "amd.ts"),
"vs/platform/product/node/package": path.resolve(vsFills, "package.ts"), "vs/platform/product/node/package": path.resolve(vsFills, "package.ts"),
......
此差异已折叠。
...@@ -4,7 +4,7 @@ set -euxo pipefail ...@@ -4,7 +4,7 @@ set -euxo pipefail
# Builds a tarfile containing vscode sourcefiles neccessary for CI. # Builds a tarfile containing vscode sourcefiles neccessary for CI.
# Done outside the CI and uploaded to object storage to reduce CI time. # Done outside the CI and uploaded to object storage to reduce CI time.
branch=1.32.0 branch=1.33.0
dir=/tmp/vstar dir=/tmp/vstar
outfile=/tmp/vstar-$branch.tar.gz outfile=/tmp/vstar-$branch.tar.gz
rm -rf $dir rm -rf $dir
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册