1- /* eslint-disable @typescript-eslint/no-explicit-any */
21import {
32 CancellationToken ,
43 Disposable ,
@@ -43,17 +42,19 @@ export function createTerminal(options: ExtensionTerminalOptions | TerminalOptio
4342 return window . createTerminal ( options ) ;
4443}
4544
46- export function onDidChangeTerminalShellIntegration (
47- listener : ( e : TerminalShellIntegrationChangeEvent ) => any ,
48- thisArgs ?: any ,
45+ /** Subscribes to shell integration changes, binding the listener to the optional receiver. */
46+ export function onDidChangeTerminalShellIntegration < TThis = void > (
47+ listener : ( this : TThis , e : TerminalShellIntegrationChangeEvent ) => void ,
48+ thisArgs ?: TThis ,
4949 disposables ?: Disposable [ ] ,
5050) : Disposable {
5151 return window . onDidChangeTerminalShellIntegration ( listener , thisArgs , disposables ) ;
5252}
5353
54- export function onDidWriteTerminalData (
55- listener : ( e : { readonly terminal : Terminal ; readonly data : string } ) => any ,
56- thisArgs ?: any ,
54+ /** Subscribes to terminal data, binding the listener to the optional receiver. */
55+ export function onDidWriteTerminalData < TThis = void > (
56+ listener : ( this : TThis , e : { readonly terminal : Terminal ; readonly data : string } ) => void ,
57+ thisArgs ?: TThis ,
5758 disposables ?: Disposable [ ] ,
5859) : Disposable {
5960 return window . onDidWriteTerminalData ( listener , thisArgs , disposables ) ;
@@ -79,57 +80,64 @@ export function activeTextEditor(): TextEditor | undefined {
7980 return window . activeTextEditor ;
8081}
8182
82- export function onDidChangeActiveTerminal (
83- listener : ( e : Terminal | undefined ) => any ,
84- thisArgs ?: any ,
83+ /** Subscribes to active terminal changes, binding the listener to the optional receiver. */
84+ export function onDidChangeActiveTerminal < TThis = void > (
85+ listener : ( this : TThis , e : Terminal | undefined ) => void ,
86+ thisArgs ?: TThis ,
8587 disposables ?: Disposable [ ] ,
8688) : Disposable {
8789 return window . onDidChangeActiveTerminal ( listener , thisArgs , disposables ) ;
8890}
8991
90- export function onDidChangeActiveTextEditor (
91- listener : ( e : TextEditor | undefined ) => any ,
92- thisArgs ?: any ,
92+ /** Subscribes to active editor changes, binding the listener to the optional receiver. */
93+ export function onDidChangeActiveTextEditor < TThis = void > (
94+ listener : ( this : TThis , e : TextEditor | undefined ) => void ,
95+ thisArgs ?: TThis ,
9396 disposables ?: Disposable [ ] ,
9497) : Disposable {
9598 return window . onDidChangeActiveTextEditor ( listener , thisArgs , disposables ) ;
9699}
97100
98- export function onDidStartTerminalShellExecution (
99- listener : ( e : TerminalShellExecutionStartEvent ) => any ,
100- thisArgs ?: any ,
101+ /** Subscribes to shell execution starts, binding the listener to the optional receiver. */
102+ export function onDidStartTerminalShellExecution < TThis = void > (
103+ listener : ( this : TThis , e : TerminalShellExecutionStartEvent ) => void ,
104+ thisArgs ?: TThis ,
101105 disposables ?: Disposable [ ] ,
102106) : Disposable {
103107 return window . onDidStartTerminalShellExecution ( listener , thisArgs , disposables ) ;
104108}
105109
106- export function onDidEndTerminalShellExecution (
107- listener : ( e : TerminalShellExecutionEndEvent ) => any ,
108- thisArgs ?: any ,
110+ /** Subscribes to shell execution completion, binding the listener to the optional receiver. */
111+ export function onDidEndTerminalShellExecution < TThis = void > (
112+ listener : ( this : TThis , e : TerminalShellExecutionEndEvent ) => void ,
113+ thisArgs ?: TThis ,
109114 disposables ?: Disposable [ ] ,
110115) : Disposable {
111116 return window . onDidEndTerminalShellExecution ( listener , thisArgs , disposables ) ;
112117}
113118
114- export function onDidOpenTerminal (
115- listener : ( terminal : Terminal ) => any ,
116- thisArgs ?: any ,
119+ /** Subscribes to opened terminals, binding the listener to the optional receiver. */
120+ export function onDidOpenTerminal < TThis = void > (
121+ listener : ( this : TThis , terminal : Terminal ) => void ,
122+ thisArgs ?: TThis ,
117123 disposables ?: Disposable [ ] ,
118124) : Disposable {
119125 return window . onDidOpenTerminal ( listener , thisArgs , disposables ) ;
120126}
121127
122- export function onDidCloseTerminal (
123- listener : ( terminal : Terminal ) => any ,
124- thisArgs ?: any ,
128+ /** Subscribes to closed terminals, binding the listener to the optional receiver. */
129+ export function onDidCloseTerminal < TThis = void > (
130+ listener : ( this : TThis , terminal : Terminal ) => void ,
131+ thisArgs ?: TThis ,
125132 disposables ?: Disposable [ ] ,
126133) : Disposable {
127134 return window . onDidCloseTerminal ( listener , thisArgs , disposables ) ;
128135}
129136
130- export function onDidChangeTerminalState (
131- listener : ( e : Terminal ) => any ,
132- thisArgs ?: any ,
137+ /** Subscribes to terminal state changes, binding the listener to the optional receiver. */
138+ export function onDidChangeTerminalState < TThis = void > (
139+ listener : ( this : TThis , e : Terminal ) => void ,
140+ thisArgs ?: TThis ,
133141 disposables ?: Disposable [ ] ,
134142) : Disposable {
135143 return window . onDidChangeTerminalState ( listener , thisArgs , disposables ) ;
@@ -340,6 +348,7 @@ export function showErrorMessage<T extends MessageItem>(
340348 return window . showErrorMessage ( message , options , ...items ) ;
341349}
342350
351+ /** Shows a warning with optional options and actions, returning the selected action unchanged. */
343352export function showWarningMessage < T extends string > ( message : string , ...items : T [ ] ) : Thenable < T | undefined > ;
344353export function showWarningMessage < T extends string > (
345354 message : string ,
@@ -352,8 +361,9 @@ export function showWarningMessage<T extends MessageItem>(
352361 options : MessageOptions ,
353362 ...items : T [ ]
354363) : Thenable < T | undefined > ;
355- export function showWarningMessage ( message : string , ...items : any [ ] ) : Thenable < string | undefined > {
356- return window . showWarningMessage ( message , ...items ) ;
364+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Forward all VS Code overloads unchanged; the public overloads above check callers.
365+ export function showWarningMessage ( message : string , ...args : any [ ] ) : Thenable < string | MessageItem | undefined > {
366+ return window . showWarningMessage ( message , ...args ) ;
357367}
358368
359369export function showInputBox ( options ?: InputBoxOptions , token ?: CancellationToken ) : Thenable < string | undefined > {
@@ -372,9 +382,10 @@ export function registerFileDecorationProvider(provider: FileDecorationProvider)
372382 return window . registerFileDecorationProvider ( provider ) ;
373383}
374384
375- export function onDidChangeWindowState (
376- listener : ( e : WindowState ) => any ,
377- thisArgs ?: any ,
385+ /** Subscribes to window state changes, binding the listener to the optional receiver. */
386+ export function onDidChangeWindowState < TThis = void > (
387+ listener : ( this : TThis , e : WindowState ) => void ,
388+ thisArgs ?: TThis ,
378389 disposables ?: Disposable [ ] ,
379390) : Disposable {
380391 return window . onDidChangeWindowState ( listener , thisArgs , disposables ) ;
0 commit comments