fix(lib/vscode): get vscode to compile
This commit is contained in:
parent
5e63b7f53c
commit
f3b1076f1d
@ -15,6 +15,23 @@ import { URI } from 'vs/base/common/uri';
|
|||||||
import { ExtensionKind } from 'vs/platform/extensions/common/extensions';
|
import { ExtensionKind } from 'vs/platform/extensions/common/extensions';
|
||||||
import { env } from 'vs/base/common/process';
|
import { env } from 'vs/base/common/process';
|
||||||
|
|
||||||
|
|
||||||
|
function parsePathArg(arg: string | undefined, process: NodeJS.Process): string | undefined {
|
||||||
|
if (!arg) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if the arg is relative or absolute, if relative use the original CWD
|
||||||
|
// (VSCODE_CWD), not the potentially overridden one (process.cwd()).
|
||||||
|
const resolved = resolve(arg);
|
||||||
|
|
||||||
|
if (normalize(arg) === resolved) {
|
||||||
|
return resolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
return resolve(process.env['VSCODE_CWD'] || process.cwd(), arg);
|
||||||
|
}
|
||||||
|
|
||||||
export interface INativeEnvironmentPaths {
|
export interface INativeEnvironmentPaths {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,6 +190,19 @@ export abstract class AbstractNativeEnvironmentService implements INativeEnviron
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE@coder: add extraExtensionPaths and extraBuiltinExtensionPaths
|
||||||
|
* Code location changed after 1.54 (was earlier directly in NativeEnvironmentService).
|
||||||
|
*/
|
||||||
|
@memoize
|
||||||
|
get extraExtensionPaths(): string[] {
|
||||||
|
return (this._args['extra-extensions-dir'] || []).map((p) => <string>parsePathArg(p, process));
|
||||||
|
}
|
||||||
|
@memoize
|
||||||
|
get extraBuiltinExtensionPaths(): string[] {
|
||||||
|
return (this._args['extra-builtin-extensions-dir'] || []).map((p) => <string>parsePathArg(p, process));
|
||||||
|
}
|
||||||
|
|
||||||
@memoize
|
@memoize
|
||||||
get extensionDevelopmentKind(): ExtensionKind[] | undefined {
|
get extensionDevelopmentKind(): ExtensionKind[] | undefined {
|
||||||
return this.args.extensionDevelopmentKind?.map(kind => kind === 'ui' || kind === 'workspace' || kind === 'web' ? kind : 'workspace');
|
return this.args.extensionDevelopmentKind?.map(kind => kind === 'ui' || kind === 'workspace' || kind === 'web' ? kind : 'workspace');
|
||||||
|
@ -33,7 +33,7 @@ import { TerminalDataBufferer } from 'vs/platform/terminal/common/terminalDataBu
|
|||||||
import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
|
import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
|
||||||
import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/terminalEnvironment';
|
import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/terminalEnvironment';
|
||||||
import { TerminalProcess } from 'vs/platform/terminal/node/terminalProcess';
|
import { TerminalProcess } from 'vs/platform/terminal/node/terminalProcess';
|
||||||
import { ISetTerminalLayoutInfoArgs, IGetTerminalLayoutInfoArgs } from 'vs/platform/terminal/common/terminalProcess';
|
import { ISetTerminalLayoutInfoArgs, IGetTerminalLayoutInfoArgs, IProcessDetails } from 'vs/platform/terminal/common/terminalProcess';
|
||||||
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
|
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
|
||||||
import { ExtensionScanner, ExtensionScannerInput } from 'vs/workbench/services/extensions/node/extensionPoints';
|
import { ExtensionScanner, ExtensionScannerInput } from 'vs/workbench/services/extensions/node/extensionPoints';
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ class Terminal {
|
|||||||
private disposeDelay = 48 * 60 * 60 * 1000;
|
private disposeDelay = 48 * 60 * 60 * 1000;
|
||||||
|
|
||||||
private buffering = false;
|
private buffering = false;
|
||||||
private readonly _onEvent = new Emitter<terminal.IRemoteTerminalProcessEvent>({
|
private readonly _onEvent = new Emitter<any>({
|
||||||
// Don't bind to data until something is listening.
|
// Don't bind to data until something is listening.
|
||||||
onFirstListenerAdd: () => {
|
onFirstListenerAdd: () => {
|
||||||
logger.debug('Terminal bound', field('id', this.id));
|
logger.debug('Terminal bound', field('id', this.id));
|
||||||
@ -461,7 +461,7 @@ class Terminal {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
public get onEvent(): Event<terminal.IRemoteTerminalProcessEvent> { return this._onEvent.event; }
|
public get onEvent(): Event<any> { return this._onEvent.event; }
|
||||||
|
|
||||||
// Buffer to reduce the number of messages going to the renderer.
|
// Buffer to reduce the number of messages going to the renderer.
|
||||||
private readonly bufferer = new TerminalDataBufferer((_, data) => {
|
private readonly bufferer = new TerminalDataBufferer((_, data) => {
|
||||||
@ -624,7 +624,7 @@ class Terminal {
|
|||||||
/**
|
/**
|
||||||
* Serializable terminal information that can be sent to the client.
|
* Serializable terminal information that can be sent to the client.
|
||||||
*/
|
*/
|
||||||
public async description(id: number): Promise<terminal.IRemoteTerminalDescriptionDto> {
|
public async description(id: number): Promise<IProcessDetails> {
|
||||||
const cwd = await this.getCwd();
|
const cwd = await this.getCwd();
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
@ -658,23 +658,22 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
|||||||
throw new Error(`Invalid listen '${event}'`);
|
throw new Error(`Invalid listen '${event}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onTerminalProcessEvent(args: terminal.IOnTerminalProcessEventArguments): Event<terminal.IRemoteTerminalProcessEvent> {
|
private onTerminalProcessEvent(id: number): Event<any> {
|
||||||
return this.getTerminal(args.id).onEvent;
|
return this.getTerminal(id).onEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public call(context: RemoteAgentConnectionContext, command: string, args?: any): Promise<any> {
|
public call(context: RemoteAgentConnectionContext, command: string, args?: any): Promise<any> {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case '$createTerminalProcess': return this.createTerminalProcess(context.remoteAuthority, args);
|
case '$createTerminalProcess': return this.createTerminalProcess(context.remoteAuthority, args);
|
||||||
case '$startTerminalProcess': return this.startTerminalProcess(args);
|
case '$startTerminalProcess': return this.startTerminalProcess(...args as [number]);
|
||||||
case '$sendInputToTerminalProcess': return this.sendInputToTerminalProcess(args);
|
case '$sendInputToTerminalProcess': return this.sendInputToTerminalProcess(...args as [number, string]);
|
||||||
case '$sendCharCountToTerminalProcess': return this.sendCharCountToTerminalProcess(args);
|
case '$sendCharCountToTerminalProcess': return this.sendCharCountToTerminalProcess(...args as [number, number]);
|
||||||
case '$shutdownTerminalProcess': return this.shutdownTerminalProcess(args);
|
case '$shutdownTerminalProcess': return this.shutdownTerminalProcess(...args as [number, boolean]);
|
||||||
case '$resizeTerminalProcess': return this.resizeTerminalProcess(args);
|
case '$resizeTerminalProcess': return this.resizeTerminalProcess(...args as [number, number, number]);
|
||||||
case '$getTerminalInitialCwd': return this.getTerminalInitialCwd(args);
|
case '$getTerminalInitialCwd': return this.getTerminalInitialCwd(...args as [number]);
|
||||||
case '$getTerminalCwd': return this.getTerminalCwd(args);
|
case '$getTerminalCwd': return this.getTerminalCwd(...args as [number]);
|
||||||
case '$sendCommandResultToTerminalProcess': return this.sendCommandResultToTerminalProcess(args);
|
case '$sendCommandResultToTerminalProcess': return this.sendCommandResultToTerminalProcess(...args as [number, number, boolean, any]);
|
||||||
case '$orphanQuestionReply': return this.orphanQuestionReply(args[0]);
|
case '$orphanQuestionReply': return this.orphanQuestionReply(...args as [number]);
|
||||||
case '$listTerminals': return this.listTerminals(args[0]);
|
|
||||||
case '$setTerminalLayoutInfo': return this.setTerminalLayoutInfo(args);
|
case '$setTerminalLayoutInfo': return this.setTerminalLayoutInfo(args);
|
||||||
case '$getTerminalLayoutInfo': return this.getTerminalLayoutInfo(args);
|
case '$getTerminalLayoutInfo': return this.getTerminalLayoutInfo(args);
|
||||||
}
|
}
|
||||||
@ -729,7 +728,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
|||||||
const executable = terminalEnvironment.getDefaultShell(
|
const executable = terminalEnvironment.getDefaultShell(
|
||||||
(key) => args.configuration[key],
|
(key) => args.configuration[key],
|
||||||
args.isWorkspaceShellAllowed,
|
args.isWorkspaceShellAllowed,
|
||||||
await getSystemShell(platform.platform),
|
await getSystemShell(platform.platform, env),
|
||||||
process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'),
|
process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'),
|
||||||
process.env.windir,
|
process.env.windir,
|
||||||
resolver,
|
resolver,
|
||||||
@ -816,7 +815,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
|||||||
terminal.onDispose(() => this.terminals.delete(terminalId));
|
terminal.onDispose(() => this.terminals.delete(terminalId));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
terminalId,
|
persistentTerminalId: terminalId,
|
||||||
resolvedShellLaunchConfig,
|
resolvedShellLaunchConfig,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -829,58 +828,44 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
|
|||||||
return terminal;
|
return terminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async startTerminalProcess(args: terminal.IStartTerminalProcessArguments): Promise<ITerminalLaunchError | void> {
|
private async startTerminalProcess(id: number): Promise<ITerminalLaunchError | void> {
|
||||||
return this.getTerminal(args.id).start();
|
return this.getTerminal(id).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async sendInputToTerminalProcess(args: terminal.ISendInputToTerminalProcessArguments): Promise<void> {
|
private async sendInputToTerminalProcess(id: number, data: string): Promise<void> {
|
||||||
return this.getTerminal(args.id).input(args.data);
|
return this.getTerminal(id).input(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async sendCharCountToTerminalProcess(args: terminal.ISendCharCountToTerminalProcessArguments): Promise<void> {
|
private async sendCharCountToTerminalProcess(id: number, charCount: number): Promise<void> {
|
||||||
return this.getTerminal(args.id).acknowledgeDataEvent(args.charCount);
|
return this.getTerminal(id).acknowledgeDataEvent(charCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async shutdownTerminalProcess(args: terminal.IShutdownTerminalProcessArguments): Promise<void> {
|
private async shutdownTerminalProcess(id: number, immediate: boolean): Promise<void> {
|
||||||
return this.getTerminal(args.id).shutdown(args.immediate);
|
return this.getTerminal(id).shutdown(immediate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async resizeTerminalProcess(args: terminal.IResizeTerminalProcessArguments): Promise<void> {
|
private async resizeTerminalProcess(id: number, cols: number, rows: number): Promise<void> {
|
||||||
return this.getTerminal(args.id).resize(args.cols, args.rows);
|
return this.getTerminal(id).resize(cols, rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getTerminalInitialCwd(args: terminal.IGetTerminalInitialCwdArguments): Promise<string> {
|
private async getTerminalInitialCwd(id: number): Promise<string> {
|
||||||
return this.getTerminal(args.id).getInitialCwd();
|
return this.getTerminal(id).getInitialCwd();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getTerminalCwd(args: terminal.IGetTerminalCwdArguments): Promise<string> {
|
private async getTerminalCwd(id: number): Promise<string> {
|
||||||
return this.getTerminal(args.id).getCwd();
|
return this.getTerminal(id).getCwd();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async sendCommandResultToTerminalProcess(_: terminal.ISendCommandResultToTerminalProcessArguments): Promise<void> {
|
private async sendCommandResultToTerminalProcess(id: number, reqId: number, isError: boolean, payload: any): Promise<void> {
|
||||||
// NOTE: Not required unless we implement the `execCommand` event, see above.
|
// NOTE: Not required unless we implement the `execCommand` event, see above.
|
||||||
throw new Error('not implemented');
|
throw new Error('not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
private async orphanQuestionReply(_: terminal.IOrphanQuestionReplyArgs): Promise<void> {
|
private async orphanQuestionReply(id: number): Promise<void> {
|
||||||
// NOTE: Not required unless we implement the `orphan?` event, see above.
|
// NOTE: Not required unless we implement the `orphan?` event, see above.
|
||||||
throw new Error('not implemented');
|
throw new Error('not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
private async listTerminals(_: terminal.IListTerminalsArgs): Promise<terminal.IRemoteTerminalDescriptionDto[]> {
|
|
||||||
// TODO: args.isInitialization. Maybe this is to have slightly different
|
|
||||||
// behavior when first listing terminals but I don't know what you'd want to
|
|
||||||
// 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]) => {
|
|
||||||
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: ISetTerminalLayoutInfoArgs): Promise<void> {
|
public async setTerminalLayoutInfo(args: ISetTerminalLayoutInfoArgs): Promise<void> {
|
||||||
this.layouts.set(args.workspaceId, args);
|
this.layouts.set(args.workspaceId, args);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
import { FileAccess } from 'vs/base/common/network';
|
||||||
import * as lp from 'vs/base/node/languagePacks';
|
import * as lp from 'vs/base/node/languagePacks';
|
||||||
import product from 'vs/platform/product/common/product';
|
import product from 'vs/platform/product/common/product';
|
||||||
import { Translations } from 'vs/workbench/services/extensions/common/extensionPoints';
|
import { Translations } from 'vs/workbench/services/extensions/common/extensionPoints';
|
||||||
|
|
||||||
const configurations = new Map<string, Promise<lp.NLSConfiguration>>();
|
const configurations = new Map<string, Promise<lp.NLSConfiguration>>();
|
||||||
const metadataPath = path.join(getPathFromAmdModule(require, ''), 'nls.metadata.json');
|
const metadataPath = path.join(FileAccess.asFileUri('', require).fsPath, 'nls.metadata.json');
|
||||||
|
|
||||||
export const isInternalConfiguration = (config: lp.NLSConfiguration): config is lp.InternalNLSConfiguration => {
|
export const isInternalConfiguration = (config: lp.NLSConfiguration): config is lp.InternalNLSConfiguration => {
|
||||||
return config && !!(<lp.InternalNLSConfiguration>config)._languagePackId;
|
return config && !!(<lp.InternalNLSConfiguration>config)._languagePackId;
|
||||||
|
@ -209,7 +209,7 @@ export class Vscode {
|
|||||||
// ../../electron-browser/sharedProcess/sharedProcessMain.ts#L148
|
// ../../electron-browser/sharedProcess/sharedProcessMain.ts#L148
|
||||||
// ../../../code/electron-main/app.ts
|
// ../../../code/electron-main/app.ts
|
||||||
private async initializeServices(args: NativeParsedArgs): Promise<void> {
|
private async initializeServices(args: NativeParsedArgs): Promise<void> {
|
||||||
const environmentService = new NativeEnvironmentService(args);
|
const environmentService = new NativeEnvironmentService(args, this.services.get<IProductService>(IProductService) as IProductService);
|
||||||
// https://github.com/cdr/code-server/issues/1693
|
// https://github.com/cdr/code-server/issues/1693
|
||||||
fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true });
|
fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true });
|
||||||
const logService = new MultiplexLogService([
|
const logService = new MultiplexLogService([
|
||||||
|
Reference in New Issue
Block a user