Не подтверждена Коммит 09fafc59 создал по автору meganrogge's avatar meganrogge
Просмотр файлов

fix #274871

владелец 0665e498
......@@ -818,12 +818,6 @@ export interface ITerminalChildProcess {
*/
acknowledgeDataEvent(charCount: number): void;
/**
* Pre-assigns the command identifier that should be associated with the next command detected by
* shell integration. This keeps the pty host and renderer command stores aligned.
*/
setNextCommandId(commandLine: string, commandId: string): Promise<void>;
/**
* Sets the unicode version for the process, this drives the size of some characters in the
* xterm-headless instance.
......@@ -1151,6 +1145,7 @@ export interface ITerminalBackend extends ITerminalBackendPtyServiceContribution
setTerminalLayoutInfo(layoutInfo?: ITerminalsLayoutInfoById): Promise<void>;
updateTitle(id: number, title: string, titleSource: TitleEventSource): Promise<void>;
updateIcon(id: number, userInitiated: boolean, icon: TerminalIcon, color?: string): Promise<void>;
setNextCommandId(id: number, commandLine: string, commandId: string): Promise<void>;
getTerminalLayoutInfo(): Promise<ITerminalsLayoutInfo | undefined>;
getPerformanceMarks(): Promise<performance.PerformanceMark[]>;
reduceConnectionGraceTime(): Promise<void>;
......
......@@ -615,10 +615,6 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
// No-op
}
async setNextCommandId(commandLine: string, commandId: string): Promise<void> {
// No-op: command IDs are tracked on the renderer and serializer only.
}
getInitialCwd(): Promise<string> {
return Promise.resolve(this._initialCwd);
}
......
......@@ -364,10 +364,6 @@ class ExtHostPseudoterminal implements ITerminalChildProcess {
// No-op, xterm-headless isn't used for extension owned terminals.
}
async setNextCommandId(commandLine: string, commandId: string): Promise<void> {
// No-op, command IDs are only tracked on the renderer for extension terminals.
}
getInitialCwd(): Promise<string> {
return Promise.resolve('');
}
......
......@@ -117,10 +117,6 @@ export class RemotePty extends BasePty implements ITerminalChildProcess {
return this._remoteTerminalChannel.setUnicodeVersion(this.id, version);
}
async setNextCommandId(commandLine: string, commandId: string): Promise<void> {
return this._remoteTerminalChannel.setNextCommandId(this.id, commandLine, commandId);
}
async refreshProperty<T extends ProcessPropertyType>(type: T): Promise<IProcessPropertyMap[T]> {
return this._remoteTerminalChannel.refreshProperty(this.id, type);
}
......
......@@ -269,6 +269,10 @@ class RemoteTerminalBackend extends BaseTerminalBackend implements ITerminalBack
await this._remoteTerminalChannel.updateIcon(id, userInitiated, icon, color);
}
async setNextCommandId(id: number, commandLine: string, commandId: string): Promise<void> {
await this._remoteTerminalChannel.setNextCommandId(id, commandLine, commandId);
}
async getDefaultSystemShell(osOverride?: OperatingSystem): Promise<string> {
return this._remoteTerminalChannel.getDefaultSystemShell(osOverride) || '';
}
......
......@@ -432,6 +432,7 @@ export interface ITerminalService extends ITerminalInstanceHost {
moveIntoNewEditor(source: ITerminalInstance): void;
moveToTerminalView(source: ITerminalInstance | URI): Promise<void>;
getPrimaryBackend(): ITerminalBackend | undefined;
setNextCommandId(id: number, commandLine: string, commandId: string): Promise<void>;
/**
* Fire the onActiveTabChanged event, this will trigger the terminal dropdown to be updated,
......
......@@ -140,10 +140,6 @@ export class TerminalProcessExtHostProxy extends Disposable implements ITerminal
// No-op
}
async setNextCommandId(commandLine: string, commandId: string): Promise<void> {
// No-op
}
async processBinary(data: string): Promise<void> {
// Disabled for extension terminals
this._onBinary.fire(data);
......
......@@ -22,7 +22,7 @@ import { FlowControlConstants, ITerminalLaunchResult, IProcessDataEvent, IProces
import { TerminalRecorder } from '../../../../platform/terminal/common/terminalRecorder.js';
import { IWorkspaceContextService, IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js';
import { EnvironmentVariableInfoChangesActive, EnvironmentVariableInfoStale } from './environmentVariableInfo.js';
import { ITerminalConfigurationService, ITerminalInstanceService } from './terminal.js';
import { ITerminalConfigurationService, ITerminalInstanceService, ITerminalService } from './terminal.js';
import { IEnvironmentVariableInfo, IEnvironmentVariableService } from '../common/environmentVariable.js';
import { MergedEnvironmentVariableCollection } from '../../../../platform/terminal/common/environmentVariableCollection.js';
import { serializeEnvironmentVariableCollections } from '../../../../platform/terminal/common/environmentVariableShared.js';
......@@ -156,7 +156,8 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
@ITerminalInstanceService private readonly _terminalInstanceService: ITerminalInstanceService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@INotificationService private readonly _notificationService: INotificationService,
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,
@ITerminalService private readonly _terminalService: ITerminalService
) {
super();
this._cwdWorkspaceFolder = terminalEnvironment.getWorkspaceForTerminal(cwd, this._workspaceContextService, this._historyService);
......@@ -595,10 +596,10 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
async setNextCommandId(commandLine: string, commandId: string): Promise<void> {
await this.ptyProcessReady;
const process = this._process;
if (!process) {
if (!process?.id) {
return;
}
await process.setNextCommandId(commandLine, commandId);
await this._terminalService.setNextCommandId(process.id, commandLine, commandId);
}
private _resize(cols: number, rows: number) {
......
......@@ -340,6 +340,13 @@ export class TerminalService extends Disposable implements ITerminalService {
return this._primaryBackend;
}
async setNextCommandId(id: number, commandLine: string, commandId: string): Promise<void> {
if (!this._primaryBackend || id <= 0) {
return;
}
await this._primaryBackend.setNextCommandId(id, commandLine, commandId);
}
private _forwardInstanceHostEvents(host: ITerminalInstanceHost) {
this._register(host.onDidChangeInstances(this._onDidChangeInstances.fire, this._onDidChangeInstances));
this._register(host.onDidDisposeInstance(this._onDidDisposeInstance.fire, this._onDidDisposeInstance));
......
......@@ -91,10 +91,6 @@ export class LocalPty extends BasePty implements ITerminalChildProcess {
return this._proxy.setUnicodeVersion(this.id, version);
}
setNextCommandId(commandLine: string, commandId: string): Promise<void> {
return this._proxy.setNextCommandId(this.id, commandLine, commandId);
}
handleOrphanQuestion() {
this._proxy.orphanQuestionReply(this.id);
}
......
......@@ -192,6 +192,10 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
await this._proxy.updateIcon(id, userInitiated, icon, color);
}
async setNextCommandId(id: number, commandLine: string, commandId: string): Promise<void> {
await this._proxy.setNextCommandId(id, commandLine, commandId);
}
async updateProperty<T extends ProcessPropertyType>(id: number, property: ProcessPropertyType, value: IProcessPropertyMap[T]): Promise<void> {
return this._proxy.updateProperty(id, property, value);
}
......
......@@ -18,7 +18,7 @@ import { TerminalCapabilityStore } from '../../../../../platform/terminal/common
import { GeneralShellType, ITerminalChildProcess, ITerminalProfile, TitleEventSource, type IShellLaunchConfig, type ITerminalBackend, type ITerminalProcessOptions } from '../../../../../platform/terminal/common/terminal.js';
import { IWorkspaceFolder } from '../../../../../platform/workspace/common/workspace.js';
import { IViewDescriptorService } from '../../../../common/views.js';
import { ITerminalConfigurationService, ITerminalInstance, ITerminalInstanceService } from '../../browser/terminal.js';
import { ITerminalConfigurationService, ITerminalInstance, ITerminalInstanceService, ITerminalService } from '../../browser/terminal.js';
import { TerminalConfigurationService } from '../../browser/terminalConfigurationService.js';
import { parseExitResult, TerminalInstance, TerminalLabelComputer } from '../../browser/terminalInstance.js';
import { IEnvironmentVariableService } from '../../common/environmentVariable.js';
......@@ -88,7 +88,6 @@ class TestTerminalChildProcess extends Disposable implements ITerminalChildProce
clearBuffer(): void { }
acknowledgeDataEvent(charCount: number): void { }
async setUnicodeVersion(version: '6' | '11'): Promise<void> { }
async setNextCommandId(commandLine: string, commandId: string): Promise<void> { }
async getInitialCwd(): Promise<string> { return ''; }
async getCwd(): Promise<string> { return ''; }
async processBinary(data: string): Promise<void> { }
......@@ -146,6 +145,7 @@ suite('Workbench - TerminalInstance', () => {
instantiationService.stub(IViewDescriptorService, new TestViewDescriptorService());
instantiationService.stub(IEnvironmentVariableService, store.add(instantiationService.createInstance(EnvironmentVariableService)));
instantiationService.stub(ITerminalInstanceService, store.add(new TestTerminalInstanceService()));
instantiationService.stub(ITerminalService, { setNextCommandId: async () => { } } as Partial<ITerminalService>);
terminalInstance = store.add(instantiationService.createInstance(TerminalInstance, terminalShellTypeContextKey, {}));
// //Wait for the teminalInstance._xtermReadyPromise to resolve
await new Promise(resolve => setTimeout(resolve, 100));
......@@ -174,6 +174,7 @@ suite('Workbench - TerminalInstance', () => {
instantiationService.stub(IViewDescriptorService, new TestViewDescriptorService());
instantiationService.stub(IEnvironmentVariableService, store.add(instantiationService.createInstance(EnvironmentVariableService)));
instantiationService.stub(ITerminalInstanceService, store.add(new TestTerminalInstanceService()));
instantiationService.stub(ITerminalService, { setNextCommandId: async () => { } } as Partial<ITerminalService>);
const taskTerminal = store.add(instantiationService.createInstance(TerminalInstance, terminalShellTypeContextKey, {
type: 'Task',
......
......@@ -11,7 +11,7 @@ import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/tes
import { IConfigurationService, type IConfigurationChangeEvent } from '../../../../../platform/configuration/common/configuration.js';
import { TestConfigurationService } from '../../../../../platform/configuration/test/common/testConfigurationService.js';
import { ITerminalChildProcess, type ITerminalBackend } from '../../../../../platform/terminal/common/terminal.js';
import { ITerminalInstanceService } from '../../browser/terminal.js';
import { ITerminalInstanceService, ITerminalService } from '../../browser/terminal.js';
import { TerminalProcessManager } from '../../browser/terminalProcessManager.js';
import { workbenchInstantiationService } from '../../../../test/browser/workbenchTestServices.js';
......@@ -44,7 +44,6 @@ class TestTerminalChildProcess implements ITerminalChildProcess {
clearBuffer(): void { }
acknowledgeDataEvent(charCount: number): void { }
async setUnicodeVersion(version: '6' | '11'): Promise<void> { }
async setNextCommandId(commandLine: string, commandId: string): Promise<void> { }
async getInitialCwd(): Promise<string> { return ''; }
async getCwd(): Promise<string> { return ''; }
async processBinary(data: string): Promise<void> { }
......@@ -97,6 +96,7 @@ suite('Workbench - TerminalProcessManager', () => {
affectsConfiguration: () => true,
} satisfies Partial<IConfigurationChangeEvent> as unknown as IConfigurationChangeEvent);
instantiationService.stub(ITerminalInstanceService, new TestTerminalInstanceService());
instantiationService.stub(ITerminalService, { setNextCommandId: async () => { } } as Partial<ITerminalService>);
manager = store.add(instantiationService.createInstance(TerminalProcessManager, 1, undefined, undefined, undefined));
});
......
......@@ -98,7 +98,8 @@ class TestRunInTerminalTool extends RunInTerminalTool {
},
});
instantiationService.stub(ITerminalService, {
onDidDisposeInstance: terminalServiceDisposeEmitter.event
onDidDisposeInstance: terminalServiceDisposeEmitter.event,
setNextCommandId: async () => { }
});
instantiationService.stub(IChatService, {
onDidDisposeSession: chatServiceDisposeEmitter.event
......
......@@ -136,9 +136,6 @@ class EmbedderTerminalProcess extends Disposable implements ITerminalChildProces
async setUnicodeVersion(): Promise<void> {
// no-op
}
async setNextCommandId(): Promise<void> {
// no-op
}
async getInitialCwd(): Promise<string> {
return '';
}
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать