diff --git a/eslint.config.js b/eslint.config.js index 678a0b6e8d8..3a84e20dcb0 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -599,7 +599,6 @@ export default tseslint.config( 'src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.ts', // Workbench 'src/vs/workbench/api/browser/mainThreadChatSessions.ts', - 'src/vs/workbench/api/browser/mainThreadTerminalService.ts', 'src/vs/workbench/api/common/configurationExtensionPoint.ts', 'src/vs/workbench/api/common/extHost.api.impl.ts', 'src/vs/workbench/api/common/extHost.protocol.ts', @@ -629,7 +628,6 @@ export default tseslint.config( 'src/vs/workbench/api/common/extHostStatusBar.ts', 'src/vs/workbench/api/common/extHostStoragePaths.ts', 'src/vs/workbench/api/common/extHostTelemetry.ts', - 'src/vs/workbench/api/common/extHostTerminalService.ts', 'src/vs/workbench/api/common/extHostTesting.ts', 'src/vs/workbench/api/common/extHostTextEditor.ts', 'src/vs/workbench/api/common/extHostTimeline.ts', @@ -898,7 +896,6 @@ export default tseslint.config( 'src/vs/workbench/services/search/node/fileSearch.ts', 'src/vs/workbench/services/search/node/rawSearchService.ts', 'src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts', - 'src/vs/workbench/services/terminal/common/embedderTerminalService.ts', 'src/vs/workbench/services/textMate/common/TMGrammarFactory.ts', 'src/vs/workbench/services/themes/browser/fileIconThemeData.ts', 'src/vs/workbench/services/themes/browser/productIconThemeData.ts', diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts index 29efe71d87c..de82ba5410d 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts @@ -926,16 +926,16 @@ import { assertNoRpc, poll } from '../utils'; applyAtProcessCreation: true, applyAtShellIntegration: false }; - deepStrictEqual(collection.get('A'), { value: '~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions }); - deepStrictEqual(collection.get('B'), { value: '~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions }); - deepStrictEqual(collection.get('C'), { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions }); + deepStrictEqual(collection.get('A'), { value: '~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions, variable: 'A' }); + deepStrictEqual(collection.get('B'), { value: '~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions, variable: 'B' }); + deepStrictEqual(collection.get('C'), { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions, variable: 'C' }); // Verify forEach const entries: [string, EnvironmentVariableMutator][] = []; collection.forEach((v, m) => entries.push([v, m])); deepStrictEqual(entries, [ - ['A', { value: '~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions }], - ['B', { value: '~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions }], - ['C', { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions }] + ['A', { value: '~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions, variable: 'A' }], + ['B', { value: '~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions, variable: 'B' }], + ['C', { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions, variable: 'C' }] ]); }); @@ -956,17 +956,17 @@ import { assertNoRpc, poll } from '../utils'; applyAtShellIntegration: false }; const expectedScopedCollection = collection.getScoped(scope); - deepStrictEqual(expectedScopedCollection.get('A'), { value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions }); - deepStrictEqual(expectedScopedCollection.get('B'), { value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions }); - deepStrictEqual(expectedScopedCollection.get('C'), { value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions }); + deepStrictEqual(expectedScopedCollection.get('A'), { value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions, variable: 'A' }); + deepStrictEqual(expectedScopedCollection.get('B'), { value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions, variable: 'B' }); + deepStrictEqual(expectedScopedCollection.get('C'), { value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions, variable: 'C' }); // Verify forEach const entries: [string, EnvironmentVariableMutator][] = []; expectedScopedCollection.forEach((v, m) => entries.push([v, m])); deepStrictEqual(entries.map(v => v[1]), [ - { value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions }, - { value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions }, - { value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions } + { value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions, variable: 'A' }, + { value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions, variable: 'B' }, + { value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions, variable: 'C' } ]); deepStrictEqual(entries.map(v => v[0]), ['A', 'B', 'C']); }); diff --git a/src/vs/workbench/api/browser/mainThreadTerminalService.ts b/src/vs/workbench/api/browser/mainThreadTerminalService.ts index a8f901b9a7c..5aa67190607 100644 --- a/src/vs/workbench/api/browser/mainThreadTerminalService.ts +++ b/src/vs/workbench/api/browser/mainThreadTerminalService.ts @@ -9,7 +9,7 @@ import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions import { URI } from '../../../base/common/uri.js'; import { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js'; import { ILogService } from '../../../platform/log/common/log.js'; -import { IProcessProperty, IProcessReadyWindowsPty, IShellLaunchConfig, IShellLaunchConfigDto, ITerminalOutputMatch, ITerminalOutputMatcher, ProcessPropertyType, TerminalExitReason, TerminalLocation } from '../../../platform/terminal/common/terminal.js'; +import { IProcessProperty, IProcessReadyWindowsPty, IShellLaunchConfig, IShellLaunchConfigDto, ITerminalOutputMatch, ITerminalOutputMatcher, ProcessPropertyType, TerminalExitReason, TerminalLocation, type IProcessPropertyMap } from '../../../platform/terminal/common/terminal.js'; import { TerminalDataBufferer } from '../../../platform/terminal/common/terminalDataBuffering.js'; import { ITerminalEditorService, ITerminalExternalLinkProvider, ITerminalGroupService, ITerminalInstance, ITerminalLink, ITerminalService } from '../../contrib/terminal/browser/terminal.js'; import { TerminalProcessExtHostProxy } from '../../contrib/terminal/browser/terminalProcessExtHostProxy.js'; @@ -452,10 +452,10 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape this._terminalProcessProxies.get(terminalId)?.emitReady(pid, cwd, windowsPty); } - public $sendProcessProperty(terminalId: number, property: IProcessProperty): void { + public $sendProcessProperty(terminalId: number, property: IProcessProperty): void { if (property.type === ProcessPropertyType.Title) { const instance = this._terminalService.getInstanceFromId(terminalId); - instance?.rename(property.value); + instance?.rename(property.value as IProcessPropertyMap[ProcessPropertyType.Title]); } this._terminalProcessProxies.get(terminalId)?.emitProcessProperty(property); } diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index ce9a7667d6e..9187e459e36 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -84,7 +84,7 @@ export class ExtHostTerminal extends Disposable { private _disposed: boolean = false; private _pidPromise: Promise; private _cols: number | undefined; - private _pidPromiseComplete: ((value: number | undefined) => any) | undefined; + private _pidPromiseComplete: ((value: number | undefined) => unknown) | undefined; private _rows: number | undefined; private _exitStatus: vscode.TerminalExitStatus | undefined; private _state: vscode.TerminalState = { isInteractedWith: false, shell: undefined }; @@ -311,7 +311,7 @@ class ExtHostPseudoterminal implements ITerminalChildProcess { public readonly onProcessData: Event = this._onProcessData.event; private readonly _onProcessReady = new Emitter(); public get onProcessReady(): Event { return this._onProcessReady.event; } - private readonly _onDidChangeProperty = new Emitter>(); + private readonly _onDidChangeProperty = new Emitter(); public readonly onDidChangeProperty = this._onDidChangeProperty.event; private readonly _onProcessExit = new Emitter(); public readonly onProcessExit: Event = this._onProcessExit.event; @@ -470,9 +470,8 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I this._proxy.$registerProcessSupport(supportsProcesses); this._extHostCommands.registerArgumentProcessor({ processArgument: arg => { - const deserialize = (arg: any) => { - const cast = arg as ISerializedTerminalInstanceContext; - return this.getTerminalById(cast.instanceId)?.value; + const deserialize = (arg: ISerializedTerminalInstanceContext) => { + return this.getTerminalById(arg.instanceId)?.value; }; switch (arg?.$mid) { case MarshalledId.TerminalContext: return deserialize(arg); @@ -1223,7 +1222,7 @@ class ScopedEnvironmentVariableCollection implements IEnvironmentVariableCollect return this.collection.get(variable, this.scope); } - forEach(callback: (variable: string, mutator: vscode.EnvironmentVariableMutator, collection: vscode.EnvironmentVariableCollection) => any, thisArg?: any): void { + forEach(callback: (variable: string, mutator: vscode.EnvironmentVariableMutator, collection: vscode.EnvironmentVariableCollection) => unknown, thisArg?: unknown): void { this.collection.getVariableMap(this.scope).forEach((value, variable) => callback.call(thisArg, variable, value, this), this.scope); } @@ -1289,7 +1288,5 @@ function convertMutator(mutator: IEnvironmentVariableMutator): vscode.Environmen const newMutator = { ...mutator }; delete newMutator.scope; newMutator.options = newMutator.options ?? undefined; - // eslint-disable-next-line local/code-no-any-casts - delete (newMutator as any).variable; return newMutator as vscode.EnvironmentVariableMutator; } diff --git a/src/vs/workbench/services/terminal/common/embedderTerminalService.ts b/src/vs/workbench/services/terminal/common/embedderTerminalService.ts index 5c1bb4361dc..585c7a3e02a 100644 --- a/src/vs/workbench/services/terminal/common/embedderTerminalService.ts +++ b/src/vs/workbench/services/terminal/common/embedderTerminalService.ts @@ -79,7 +79,7 @@ class EmbedderTerminalProcess extends Disposable implements ITerminalChildProces readonly onProcessData: Event; private readonly _onProcessReady = this._register(new Emitter()); readonly onProcessReady = this._onProcessReady.event; - private readonly _onDidChangeProperty = this._register(new Emitter>()); + private readonly _onDidChangeProperty = this._register(new Emitter()); readonly onDidChangeProperty = this._onDidChangeProperty.event; private readonly _onProcessExit = this._register(new Emitter()); readonly onProcessExit = this._onProcessExit.event; @@ -149,7 +149,7 @@ class EmbedderTerminalProcess extends Disposable implements ITerminalChildProces throw new Error(`refreshProperty is not suppported in EmbedderTerminalProcess. property: ${property}`); } - updateProperty(property: ProcessPropertyType, value: any): Promise { + updateProperty(property: ProcessPropertyType, value: unknown): Promise { throw new Error(`updateProperty is not suppported in EmbedderTerminalProcess. property: ${property}, value: ${value}`); } }