Change:
Right now there is only method which is called by different user actions. I need to distinguish the case when the terminal is closed because the user explicitly requested closing of this terminal or because a user, for instance, close the window and disposure of the frontend terminal as well as the ext host terminal service call . Maybe is missing? Context: I have long-running processes to which pty is connecting. Such processes should be stopped if a user requests explicit killing of frontend terminals, otherwise they should not be. But right now they got stopped whenever a user closes the window.
Does this work?
It is for me in both cases, i.e. when I reload the page and forcefully kills the terminal.
I believe we treat both these cases the same internally, I since there is the difference of the extension host going down when a window is closed or reloaded, take that into consideration as to whether you want to kill the long running process or not.
Is this still out of scope? I have a hack in my extension as you suggested by it's broken now due to , which I'm sure it will be fixed, but having a way to differentiate when a user closes the terminal explicitly would be nice
Would you be opened if we propose some API to distinguish between close caused by explicit user action to kill the terminal or by system (i.e. unload of extension host caused by window reload or close). As mentioned we have code like that: which got broke by last release, but generally we hear complaints from time to time that underlying jobs getting closed by window reloads. We would like to have more robust means than timeout.
Sure you can propose and I'll bring it to our API meeting to discuss, I guess something like is what you're after?

Discussion:
telemetry: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.telemetry.d.ts', terminalDataWriteEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts', terminalDimensions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts', <del> terminalExitReason: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalExitReason.d.ts', </del> testCoverage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testCoverage.d.ts', testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts', textSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',

*   without providing an exit code. */ readonly code: number | undefined; <ins> /** * The reason that triggered the exit of a terminal. */ readonly reason: TerminalExitReason; } /** * Terminal exit reason kind. */ export enum TerminalExitReason { /** * Unknown reason. */ Unknown = 0, /** * The window closed/reloaded. */ Shutdown = 1, /** * The shell process exited. */ Process = 2, /** * The user closed the terminal. */ User = 3, /** * An extension disposed the terminal. */ Extension = 4, </ins> } /**

<del> /*--------------------------------------------------------------------------------------------- *  Copyright (c) Microsoft Corporation. All rights reserved. *  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/130231 /** * Terminal exit reason kind. */ export enum TerminalExitReason { /** * Unknown reason. */ Unknown = 0, /** * The window closed/reloaded. */ Shutdown = 1, /** * The shell process exited. */ Process = 2, /** * The user closed the terminal. */ User = 3, /** * An extension disposed the terminal. */ Extension = 4, } export interface TerminalExitStatus { /** * The reason that triggered the exit of a terminal. */ readonly reason: TerminalExitReason; } } </del>