New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminal shell integration proposed api #208257
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc/ @karthiknadig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TPI doc review
export interface Terminal { | ||
/** | ||
* An object that contains [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered | ||
* features for the terminal. This will always be undefined immediately after the terminal | ||
* is created. Listen to {@link window.onDidActivateTerminalShellIntegration} to be notified | ||
* when shell integration is activated for a terminal. | ||
*/ | ||
shellIntegration: TerminalShellIntegration | undefined; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably include a note that shell integration may never activate for a terminal. For eg. One common case is command prompt
* The current working directory of the terminal. This will be a {@link Uri} if the string | ||
* reported by the shell can reliably be mapped to the connected machine. | ||
*/ | ||
cwd: Uri | string | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be readonly
export interface TerminalShellIntegrationChangeEvent { | ||
/** | ||
* The terminal that shell integration has been activated in. | ||
*/ | ||
terminal: Terminal; | ||
/** | ||
* The shell integration object. | ||
*/ | ||
shellIntegration: TerminalShellIntegration; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
terminal: Terminal; | ||
|
||
/** | ||
* The full command line that was executed, including both the command and arguments. | ||
* The accuracy of this value depends on the shell integration implementation: | ||
* | ||
* - It may be undefined or the empty string until {@link onDidEndTerminalShellExecution} is | ||
* fired. | ||
* - It may be inaccurate initially if the command line is pulled from the buffer directly | ||
* via the [`OSC 633/133 ; A`, `B` and `C` sequences](https://code.visualstudio.com/docs/terminal/shell-integration#_vs-code-custom-sequences-osc-633-st). | ||
* - It may contain line continuation characters and/or parts of the right prompt. | ||
* - It may be inaccurate if the shell integration does not support command line reporting | ||
* via the [`OSC 633 ; E` sequence](https://code.visualstudio.com/docs/terminal/shell-integration#_vs-code-custom-sequences-osc-633-st). | ||
*/ | ||
commandLine: string | undefined; | ||
|
||
/** | ||
* The working directory that was reported by the shell when this command executed. This | ||
* will be a {@link Uri} if the string reported by the shell can reliably be mapped to the | ||
* connected machine. This requires the shell integration to support working directory | ||
* reporting via the [`OSC 633 ; P`](https://code.visualstudio.com/docs/terminal/shell-integration#_vs-code-custom-sequences-osc-633-st) | ||
* or `OSC 1337 ; CurrentDir=<Cwd> ST` sequences. | ||
*/ | ||
cwd: Uri | string | undefined; | ||
|
||
/** | ||
* The exit code reported by the shell. | ||
*/ | ||
exitCode: Thenable<number | undefined>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
Part of #145234
This is the initial implementation of the new
Terminal.shellIntegration
and related proposed APIs. There are a few TODOs still in the code but these will get resolved before finalization.@karrtikr these still aren't set in stone but it is probably worth trying to implement something against it for feedback once merged.