Fix outdated examples in api jsdoc

Fixes #216545
This commit is contained in:
Daniel Imms 2024-06-18 13:29:16 -07:00
parent 7696c3e01d
commit c6be7241b1
No known key found for this signature in database
GPG key ID: E5CF412B63651C69

View file

@ -125,7 +125,7 @@ declare module 'vscode' {
/**
* 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
* is created. Listen to {@link window.onDidChangeTerminalShellIntegration} to be notified
* when shell integration is activated for a terminal.
*
* Note that this object may remain undefined if shell integation never activates. For
@ -155,11 +155,13 @@ declare module 'vscode' {
* @example
* // Execute a command in a terminal immediately after being created
* const myTerm = window.createTerminal();
* window.onDidActivateTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
* window.onDidChangeTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
* if (terminal === myTerm) {
* const command = shellIntegration.executeCommand('echo "Hello world"');
* const code = await command.exitCode;
* console.log(`Command exited with code ${code}`);
* const execution = shellIntegration.executeCommand('echo "Hello world"');
* window.onDidEndTerminalShellExecution(event => {
* if (event.execution === execution) {
* console.log(`Command exited with code ${event.exitCode}`);
* }
* }
* }));
* // Fallback to sendText if there is no shell integration within 3 seconds of launching
@ -175,9 +177,11 @@ declare module 'vscode' {
* // Send command to terminal that has been alive for a while
* const commandLine = 'echo "Hello world"';
* if (term.shellIntegration) {
* const command = term.shellIntegration.executeCommand({ commandLine });
* const code = await command.exitCode;
* console.log(`Command exited with code ${code}`);
* const execution = shellIntegration.executeCommand({ commandLine });
* window.onDidEndTerminalShellExecution(event => {
* if (event.execution === execution) {
* console.log(`Command exited with code ${event.exitCode}`);
* }
* } else {
* term.sendText(commandLine);
* // Without shell integration, we can't know when the command has finished or what the