|
1 | 1 | import pWaitFor from "p-wait-for" |
2 | 2 | import * as vscode from "vscode" |
3 | | - |
4 | | -/* |
5 | | -The new shellIntegration API gives us access to terminal command execution output handling. |
6 | | -However, we don't update our VSCode type definitions or engine requirements to maintain compatibility |
7 | | -with older VSCode versions. Users on older versions will automatically fall back to using sendText |
8 | | -for terminal command execution. |
9 | | -Interestingly, some environments like Cursor enable these APIs even without the latest VSCode engine. |
10 | | -This approach allows us to leverage advanced features when available while ensuring broad compatibility. |
11 | | -*/ |
12 | | -declare module "vscode" { |
13 | | - // https://github.com/microsoft/vscode/blob/f0417069c62e20f3667506f4b7e53ca0004b4e3e/src/vscode-dts/vscode.d.ts#L7442 |
14 | | - interface Terminal { |
15 | | - shellIntegration?: { |
16 | | - cwd?: vscode.Uri |
17 | | - executeCommand?: (command: string) => { |
18 | | - read: () => AsyncIterable<string> |
19 | | - } |
20 | | - } |
21 | | - } |
22 | | - // https://github.com/microsoft/vscode/blob/f0417069c62e20f3667506f4b7e53ca0004b4e3e/src/vscode-dts/vscode.d.ts#L10794 |
23 | | - interface Window { |
24 | | - onDidStartTerminalShellExecution?: ( |
25 | | - listener: (e: any) => any, |
26 | | - thisArgs?: any, |
27 | | - disposables?: vscode.Disposable[], |
28 | | - ) => vscode.Disposable |
29 | | - } |
30 | | -} |
31 | 3 | import { arePathsEqual } from "../../utils/path" |
32 | 4 | import { mergePromise, TerminalProcess, TerminalProcessResultPromise } from "./TerminalProcess" |
33 | 5 | import { TerminalInfo, TerminalRegistry } from "./TerminalRegistry" |
@@ -89,6 +61,34 @@ Resources: |
89 | 61 | - https://github.com/microsoft/vscode-extension-samples/blob/main/shell-integration-sample/src/extension.ts |
90 | 62 | */ |
91 | 63 |
|
| 64 | +/* |
| 65 | +The new shellIntegration API gives us access to terminal command execution output handling. |
| 66 | +However, we don't update our VSCode type definitions or engine requirements to maintain compatibility |
| 67 | +with older VSCode versions. Users on older versions will automatically fall back to using sendText |
| 68 | +for terminal command execution. |
| 69 | +Interestingly, some environments like Cursor enable these APIs even without the latest VSCode engine. |
| 70 | +This approach allows us to leverage advanced features when available while ensuring broad compatibility. |
| 71 | +*/ |
| 72 | +declare module "vscode" { |
| 73 | + // https://github.com/microsoft/vscode/blob/f0417069c62e20f3667506f4b7e53ca0004b4e3e/src/vscode-dts/vscode.d.ts#L7442 |
| 74 | + interface Terminal { |
| 75 | + shellIntegration?: { |
| 76 | + cwd?: vscode.Uri |
| 77 | + executeCommand?: (command: string) => { |
| 78 | + read: () => AsyncIterable<string> |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | + // https://github.com/microsoft/vscode/blob/f0417069c62e20f3667506f4b7e53ca0004b4e3e/src/vscode-dts/vscode.d.ts#L10794 |
| 83 | + interface Window { |
| 84 | + onDidStartTerminalShellExecution?: ( |
| 85 | + listener: (e: any) => any, |
| 86 | + thisArgs?: any, |
| 87 | + disposables?: vscode.Disposable[], |
| 88 | + ) => vscode.Disposable |
| 89 | + } |
| 90 | +} |
| 91 | + |
92 | 92 | export class TerminalManager { |
93 | 93 | private terminalIds: Set<number> = new Set() |
94 | 94 | private processes: Map<number, TerminalProcess> = new Map() |
|
0 commit comments