fix(lib/vscode): fix terminal channel

上级 9665127d
...@@ -43,7 +43,7 @@ import { ExtensionScanner, ExtensionScannerInput } from 'vs/workbench/services/e ...@@ -43,7 +43,7 @@ import { ExtensionScanner, ExtensionScannerInput } from 'vs/workbench/services/e
class Watcher extends DiskFileSystemProvider { class Watcher extends DiskFileSystemProvider {
public readonly watches = new Map<number, IDisposable>(); public readonly watches = new Map<number, IDisposable>();
public dispose(): void { public override dispose(): void {
this.watches.forEach((w) => w.dispose()); this.watches.forEach((w) => w.dispose());
this.watches.clear(); this.watches.clear();
super.dispose(); super.dispose();
...@@ -263,6 +263,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel { ...@@ -263,6 +263,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
globalStorageHome: this.environment.globalStorageHome, globalStorageHome: this.environment.globalStorageHome,
workspaceStorageHome: this.environment.workspaceStorageHome, workspaceStorageHome: this.environment.workspaceStorageHome,
userHome: this.environment.userHome, userHome: this.environment.userHome,
useHostProxy: false,
os: platform.OS, os: platform.OS,
marks: [] marks: []
}; };
...@@ -382,7 +383,7 @@ class VariableResolverService extends AbstractVariableResolverService { ...@@ -382,7 +383,7 @@ class VariableResolverService extends AbstractVariableResolverService {
getLineNumber: (): string | undefined => { getLineNumber: (): string | undefined => {
return args.resolvedVariables.selectedText; return args.resolvedVariables.selectedText;
}, },
}, undefined, env); }, undefined, Promise.resolve(env));
} }
} }
...@@ -442,6 +443,7 @@ class Terminal extends TerminalProcess { ...@@ -442,6 +443,7 @@ class Terminal extends TerminalProcess {
workspaceId: this.workspaceId, workspaceId: this.workspaceId,
workspaceName: this.workspaceName, workspaceName: this.workspaceName,
isOrphan: this.isOrphan, isOrphan: this.isOrphan,
icon: 'bash' // TODO@oxy: currently unused by vscode
}; };
} }
} }
...@@ -472,8 +474,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec ...@@ -472,8 +474,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
// 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((id, data) => { private readonly bufferer = new TerminalDataBufferer((id, data) => {
// TODO: Not sure what sync means. this._onProcessData.fire({ id, event: data });
this._onProcessData.fire({ id, event: { data, sync: true }});
}); });
public constructor (private readonly logService: ILogService) {} public constructor (private readonly logService: ILogService) {}
...@@ -564,27 +565,26 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec ...@@ -564,27 +565,26 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
toResource: (relativePath: string) => resources.joinPath(activeWorkspaceUri, relativePath), toResource: (relativePath: string) => resources.joinPath(activeWorkspaceUri, relativePath),
} : undefined; } : undefined;
const resolverService = new VariableResolverService(remoteAuthority, args, process.env as platform.IProcessEnvironment); const resolverService = new VariableResolverService(remoteAuthority, args, process.env);
const resolver = terminalEnvironment.createVariableResolver(activeWorkspace, resolverService); const resolver = terminalEnvironment.createVariableResolver(activeWorkspace, process.env, resolverService);
const getDefaultShellAndArgs = async (): Promise<{ executable: string; args: string[] | string }> => { const getDefaultShellAndArgs = async (): Promise<{ executable: string; args: string[] | string }> => {
if (shellLaunchConfig.executable) { if (shellLaunchConfig.executable) {
const executable = resolverService.resolve(activeWorkspace, shellLaunchConfig.executable); const executable = await resolverService.resolveAsync(activeWorkspace, shellLaunchConfig.executable);
let resolvedArgs: string[] | string = []; let resolvedArgs: string[] | string = [];
if (shellLaunchConfig.args && Array.isArray(shellLaunchConfig.args)) { if (shellLaunchConfig.args && Array.isArray(shellLaunchConfig.args)) {
for (const arg of shellLaunchConfig.args) { for (const arg of shellLaunchConfig.args) {
resolvedArgs.push(resolverService.resolve(activeWorkspace, arg)); resolvedArgs.push(await resolverService.resolveAsync(activeWorkspace, arg));
} }
} else if (shellLaunchConfig.args) { } else if (shellLaunchConfig.args) {
resolvedArgs = resolverService.resolve(activeWorkspace, shellLaunchConfig.args); resolvedArgs = await resolverService.resolveAsync(activeWorkspace, shellLaunchConfig.args);
} }
return { executable, args: resolvedArgs }; return { executable, args: resolvedArgs };
} }
const executable = terminalEnvironment.getDefaultShell( const executable = terminalEnvironment.getDefaultShell(
(key) => args.configuration[key], (key) => args.configuration[key],
args.isWorkspaceShellAllowed, await getSystemShell(platform.OS, process.env as platform.IProcessEnvironment),
await getSystemShell(platform.platform, process.env as platform.IProcessEnvironment),
process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'), process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'),
process.env.windir, process.env.windir,
resolver, resolver,
...@@ -594,7 +594,6 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec ...@@ -594,7 +594,6 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
const resolvedArgs = terminalEnvironment.getDefaultShellArgs( const resolvedArgs = terminalEnvironment.getDefaultShellArgs(
(key) => args.configuration[key], (key) => args.configuration[key],
args.isWorkspaceShellAllowed,
false, // useAutomationShell false, // useAutomationShell
resolver, resolver,
this.logService, this.logService,
...@@ -625,7 +624,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec ...@@ -625,7 +624,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
logger.debug('Resolved shell launch configuration', field('id', terminalId)); logger.debug('Resolved shell launch configuration', field('id', terminalId));
// Use instead of `terminal.integrated.env.${platform}` to make types work. // Use instead of `terminal.integrated.env.${platform}` to make types work.
const getEnvFromConfig = (): terminal.ISingleTerminalConfiguration<ITerminalEnvironment> => { const getEnvFromConfig = (): ITerminalEnvironment => {
if (platform.isWindows) { if (platform.isWindows) {
return args.configuration['terminal.integrated.env.windows']; return args.configuration['terminal.integrated.env.windows'];
} else if (platform.isMacintosh) { } else if (platform.isMacintosh) {
...@@ -635,7 +634,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec ...@@ -635,7 +634,7 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
}; };
const getNonInheritedEnv = async (): Promise<platform.IProcessEnvironment> => { const getNonInheritedEnv = async (): Promise<platform.IProcessEnvironment> => {
const env = await getMainProcessParentEnv(); const env = await getMainProcessParentEnv(process.env);
env.VSCODE_IPC_HOOK_CLI = process.env['VSCODE_IPC_HOOK_CLI']!; env.VSCODE_IPC_HOOK_CLI = process.env['VSCODE_IPC_HOOK_CLI']!;
return env; return env;
}; };
...@@ -644,7 +643,6 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec ...@@ -644,7 +643,6 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
shellLaunchConfig, shellLaunchConfig,
getEnvFromConfig(), getEnvFromConfig(),
resolver, resolver,
args.isWorkspaceShellAllowed,
product.version, product.version,
args.configuration['terminal.integrated.detectLocale'], args.configuration['terminal.integrated.detectLocale'],
args.configuration['terminal.integrated.inheritEnv'] !== false args.configuration['terminal.integrated.inheritEnv'] !== false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册