Merge pull request #2773 from cdr/upgrade-vscode-1.53
feat(vscode): update to version 1.53.2
This commit is contained in:
@ -68,7 +68,7 @@ process.on('message', async (message: CodeServerMessage, socket) => {
|
||||
}
|
||||
break;
|
||||
case 'socket':
|
||||
vscode.handleWebSocket(socket, message.query);
|
||||
vscode.handleWebSocket(socket, message.query, message.permessageDeflate);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
1
lib/vscode/src/vs/server/ipc.d.ts
vendored
1
lib/vscode/src/vs/server/ipc.d.ts
vendored
@ -19,6 +19,7 @@ export type Query = { [key: string]: string | string[] | undefined | Query | Que
|
||||
export interface SocketMessage {
|
||||
type: 'socket';
|
||||
query: Query;
|
||||
permessageDeflate: boolean;
|
||||
}
|
||||
|
||||
export interface CliMessage {
|
||||
|
@ -10,6 +10,7 @@ import * as resources from 'vs/base/common/resources';
|
||||
import { ReadableStreamEventPayload } from 'vs/base/common/stream';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { transformOutgoingURIs } from 'vs/base/common/uriIpc';
|
||||
import { getSystemShell } from 'vs/base/node/shell';
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
@ -27,10 +28,9 @@ import { IEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/co
|
||||
import { MergedEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariableCollection';
|
||||
import { deserializeEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariableShared';
|
||||
import * as terminal from 'vs/workbench/contrib/terminal/common/remoteTerminalChannel';
|
||||
import { IShellLaunchConfig, ITerminalEnvironment, ITerminalLaunchError } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { IShellLaunchConfig, ITerminalEnvironment, ITerminalLaunchError, ITerminalsLayoutInfo } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { TerminalDataBufferer } from 'vs/workbench/contrib/terminal/common/terminalDataBuffering';
|
||||
import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
|
||||
import { getSystemShell } from 'vs/workbench/contrib/terminal/node/terminal';
|
||||
import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/terminalEnvironment';
|
||||
import { TerminalProcess } from 'vs/workbench/contrib/terminal/node/terminalProcess';
|
||||
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
|
||||
@ -263,6 +263,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
|
||||
workspaceStorageHome: this.environment.workspaceStorageHome,
|
||||
userHome: this.environment.userHome,
|
||||
os: platform.OS,
|
||||
marks: []
|
||||
};
|
||||
}
|
||||
|
||||
@ -303,7 +304,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
|
||||
const newPath = extension.extensionLocation.fsPath;
|
||||
this.log.warn(`${oldPath} has been overridden ${newPath}`);
|
||||
}
|
||||
uniqueExtensions.set(id, extension)
|
||||
uniqueExtensions.set(id, extension);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -610,6 +611,22 @@ class Terminal {
|
||||
this.rows = rows;
|
||||
return this.process.resize(cols, rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializable terminal information that can be sent to the client.
|
||||
*/
|
||||
public async description(id: number): Promise<terminal.IRemoteTerminalDescriptionDto> {
|
||||
const cwd = await this.getCwd();
|
||||
return {
|
||||
id,
|
||||
pid: this.pid,
|
||||
title: this.title,
|
||||
cwd,
|
||||
workspaceId: this.workspaceId,
|
||||
workspaceName: this.workspaceName,
|
||||
isOrphan: this.isOrphan,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// References: - ../../workbench/api/node/extHostTerminalService.ts
|
||||
@ -618,6 +635,8 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
||||
private readonly terminals = new Map<number, Terminal>();
|
||||
private id = 0;
|
||||
|
||||
private readonly layouts = new Map<string, terminal.ISetTerminalLayoutInfoArgs>();
|
||||
|
||||
public constructor (private readonly logService: ILogService) {
|
||||
|
||||
}
|
||||
@ -646,6 +665,8 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
||||
case '$sendCommandResultToTerminalProcess': return this.sendCommandResultToTerminalProcess(args);
|
||||
case '$orphanQuestionReply': return this.orphanQuestionReply(args[0]);
|
||||
case '$listTerminals': return this.listTerminals(args[0]);
|
||||
case '$setTerminalLayoutInfo': return this.setTerminalLayoutInfo(args);
|
||||
case '$getTerminalLayoutInfo': return this.getTerminalLayoutInfo(args);
|
||||
}
|
||||
|
||||
throw new Error(`Invalid call '${command}'`);
|
||||
@ -681,7 +702,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
||||
const resolverService = new VariableResolverService(remoteAuthority, args, process.env as platform.IProcessEnvironment);
|
||||
const resolver = terminalEnvironment.createVariableResolver(activeWorkspace, resolverService);
|
||||
|
||||
const getDefaultShellAndArgs = (): { executable: string; args: string[] | string } => {
|
||||
const getDefaultShellAndArgs = async (): Promise<{ executable: string; args: string[] | string }> => {
|
||||
if (shellLaunchConfig.executable) {
|
||||
const executable = resolverService.resolve(activeWorkspace, shellLaunchConfig.executable);
|
||||
let resolvedArgs: string[] | string = [];
|
||||
@ -698,7 +719,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
||||
const executable = terminalEnvironment.getDefaultShell(
|
||||
(key) => args.configuration[key],
|
||||
args.isWorkspaceShellAllowed,
|
||||
getSystemShell(platform.platform),
|
||||
await getSystemShell(platform.platform),
|
||||
process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'),
|
||||
process.env.windir,
|
||||
resolver,
|
||||
@ -732,7 +753,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
||||
// longer undefined.
|
||||
const resolvedShellLaunchConfig = {
|
||||
...shellLaunchConfig,
|
||||
...getDefaultShellAndArgs(),
|
||||
...(await getDefaultShellAndArgs()),
|
||||
cwd: getInitialCwd(),
|
||||
};
|
||||
|
||||
@ -838,24 +859,53 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
||||
// do differently. Maybe it's to reset the terminal dispose timeouts or
|
||||
// something like that, but why not do it each time you list?
|
||||
const terminals = await Promise.all(Array.from(this.terminals).map(async ([id, terminal]) => {
|
||||
const cwd = await terminal.getCwd();
|
||||
return {
|
||||
id,
|
||||
pid: terminal.pid,
|
||||
title: terminal.title,
|
||||
cwd,
|
||||
workspaceId: terminal.workspaceId,
|
||||
workspaceName: terminal.workspaceName,
|
||||
isOrphan: terminal.isOrphan,
|
||||
};
|
||||
return terminal.description(id);
|
||||
}));
|
||||
|
||||
// Only returned orphaned terminals so we don't end up attaching to
|
||||
// terminals already attached elsewhere.
|
||||
return terminals.filter((t) => t.isOrphan);
|
||||
}
|
||||
|
||||
public async setTerminalLayoutInfo(args: terminal.ISetTerminalLayoutInfoArgs): Promise<void> {
|
||||
this.layouts.set(args.workspaceId, args);
|
||||
}
|
||||
|
||||
public async getTerminalLayoutInfo(args: terminal.IGetTerminalLayoutInfoArgs): Promise<ITerminalsLayoutInfo | undefined> {
|
||||
const layout = this.layouts.get(args.workspaceId);
|
||||
if (!layout) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const tabs = await Promise.all(layout.tabs.map(async (tab) => {
|
||||
// The terminals are stored by ID so look them up.
|
||||
const terminals = await Promise.all(tab.terminals.map(async (t) => {
|
||||
const terminal = this.terminals.get(t.terminal);
|
||||
if (!terminal) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
...t,
|
||||
terminal: await terminal.description(t.terminal),
|
||||
};
|
||||
}));
|
||||
|
||||
return {
|
||||
...tab,
|
||||
// Filter out terminals that have been killed.
|
||||
terminals: terminals.filter(isDefined),
|
||||
};
|
||||
}));
|
||||
|
||||
return { tabs };
|
||||
}
|
||||
}
|
||||
|
||||
function transformIncoming(remoteAuthority: string, uri: UriComponents | undefined): URI | undefined {
|
||||
const transformer = getUriTransformer(remoteAuthority);
|
||||
return uri ? URI.revive(transformer.transformIncoming(uri)) : uri;
|
||||
}
|
||||
|
||||
function isDefined<T>(t: T | undefined): t is T {
|
||||
return typeof t !== 'undefined';
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { ISocket } from 'vs/base/parts/ipc/common/ipc.net';
|
||||
import { NodeSocket } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { WebSocketNodeSocket } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { getNlsConfiguration } from 'vs/server/node/nls';
|
||||
import { Protocol } from 'vs/server/node/protocol';
|
||||
@ -54,7 +54,7 @@ export abstract class Connection {
|
||||
export class ManagementConnection extends Connection {
|
||||
public constructor(protected protocol: Protocol, token: string) {
|
||||
super(protocol, token);
|
||||
protocol.onClose(() => this.dispose()); // Explicit close.
|
||||
protocol.onDidDispose(() => this.dispose()); // Explicit close.
|
||||
protocol.onSocketClose(() => this.setOffline()); // Might reconnect.
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ export class ExtensionHostConnection extends Connection {
|
||||
private readonly logger: Logger;
|
||||
|
||||
public constructor(
|
||||
locale:string, protocol: Protocol, buffer: VSBuffer, token: string,
|
||||
locale: string, protocol: Protocol, buffer: VSBuffer, token: string,
|
||||
private readonly environment: INativeEnvironmentService,
|
||||
) {
|
||||
super(protocol, token);
|
||||
@ -115,11 +115,18 @@ export class ExtensionHostConnection extends Connection {
|
||||
private sendInitMessage(buffer: VSBuffer): void {
|
||||
const socket = this.protocol.getUnderlyingSocket();
|
||||
socket.pause();
|
||||
|
||||
const wrapperSocket = this.protocol.getSocket();
|
||||
|
||||
this.logger.trace('Sending socket');
|
||||
this.process!.send({ // Process must be set at this point.
|
||||
type: 'VSCODE_EXTHOST_IPC_SOCKET',
|
||||
initialDataChunk: (buffer.buffer as Buffer).toString('base64'),
|
||||
skipWebSocketFrames: this.protocol.getSocket() instanceof NodeSocket,
|
||||
initialDataChunk: Buffer.from(buffer.buffer).toString('base64'),
|
||||
skipWebSocketFrames: !(wrapperSocket instanceof WebSocketNodeSocket),
|
||||
permessageDeflate: this.protocol.options.permessageDeflate,
|
||||
inflateBytes: wrapperSocket instanceof WebSocketNodeSocket
|
||||
? Buffer.from(wrapperSocket.recordedInflateBytes.buffer).toString('base64')
|
||||
: undefined,
|
||||
}, socket);
|
||||
}
|
||||
|
||||
@ -136,14 +143,15 @@ export class ExtensionHostConnection extends Connection {
|
||||
{
|
||||
env: {
|
||||
...process.env,
|
||||
AMD_ENTRYPOINT: 'vs/workbench/services/extensions/node/extensionHostProcess',
|
||||
PIPE_LOGGING: 'true',
|
||||
VERBOSE_LOGGING: 'true',
|
||||
VSCODE_AMD_ENTRYPOINT: 'vs/workbench/services/extensions/node/extensionHostProcess',
|
||||
VSCODE_PIPE_LOGGING: 'true',
|
||||
VSCODE_VERBOSE_LOGGING: 'true',
|
||||
VSCODE_EXTHOST_WILL_SEND_SOCKET: 'true',
|
||||
VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true',
|
||||
VSCODE_LOG_STACK: 'false',
|
||||
VSCODE_LOG_LEVEL: process.env.LOG_LEVEL,
|
||||
VSCODE_NLS_CONFIG: JSON.stringify(config),
|
||||
VSCODE_PARENT_PID: String(process.pid),
|
||||
},
|
||||
silent: true,
|
||||
},
|
||||
|
@ -10,6 +10,9 @@ export interface SocketOptions {
|
||||
readonly reconnectionToken: string;
|
||||
readonly reconnection: boolean;
|
||||
readonly skipWebSocketFrames: boolean;
|
||||
readonly permessageDeflate?: boolean;
|
||||
readonly inflateBytes?: VSBuffer;
|
||||
readonly recordInflateBytes?: boolean;
|
||||
}
|
||||
|
||||
export class Protocol extends PersistentProtocol {
|
||||
@ -17,7 +20,12 @@ export class Protocol extends PersistentProtocol {
|
||||
super(
|
||||
options.skipWebSocketFrames
|
||||
? new NodeSocket(socket)
|
||||
: new WebSocketNodeSocket(new NodeSocket(socket)),
|
||||
: new WebSocketNodeSocket(
|
||||
new NodeSocket(socket),
|
||||
options.permessageDeflate || false,
|
||||
options.inflateBytes || null,
|
||||
options.recordInflateBytes || false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { field } from '@coder/logger';
|
||||
import { release } from 'os';
|
||||
import * as fs from 'fs';
|
||||
import * as net from 'net';
|
||||
import * as path from 'path';
|
||||
@ -44,7 +45,7 @@ import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogA
|
||||
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { combinedAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
|
||||
import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
|
||||
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
|
||||
import { TelemetryChannel } from 'vs/server/common/telemetry';
|
||||
import { Query, VscodeOptions, WorkbenchOptions } from 'vs/server/ipc';
|
||||
import { ExtensionEnvironmentChannel, FileProviderChannel, TerminalProviderChannel } from 'vs/server/node/channel';
|
||||
@ -119,7 +120,7 @@ export class Vscode {
|
||||
};
|
||||
}
|
||||
|
||||
public async handleWebSocket(socket: net.Socket, query: Query): Promise<true> {
|
||||
public async handleWebSocket(socket: net.Socket, query: Query, _permessageDeflate: boolean): Promise<true> {
|
||||
if (!query.reconnectionToken) {
|
||||
throw new Error('Reconnection token is missing from query parameters');
|
||||
}
|
||||
@ -127,6 +128,7 @@ export class Vscode {
|
||||
reconnectionToken: <string>query.reconnectionToken,
|
||||
reconnection: query.reconnection === 'true',
|
||||
skipWebSocketFrames: query.skipWebSocketFrames === 'true',
|
||||
// TODO: permessageDeflate,
|
||||
});
|
||||
try {
|
||||
await this.connect(await protocol.handshake(), protocol);
|
||||
@ -259,7 +261,7 @@ export class Vscode {
|
||||
),
|
||||
sendErrorTelemetry: true,
|
||||
commonProperties: resolveCommonProperties(
|
||||
product.commit, product.version, machineId,
|
||||
fileService, release(), process.arch, product.commit, product.version, machineId,
|
||||
[], environmentService.installSourcePath, 'code-server',
|
||||
),
|
||||
piiPaths,
|
||||
|
Reference in New Issue
Block a user