Skip to content

Commit 9f418b1

Browse files
committed
cleanup vscode module declaration
1 parent 1b56c3f commit 9f418b1

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/integrations/terminal/TerminalManager.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,5 @@
11
import pWaitFor from "p-wait-for"
22
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-
}
313
import { arePathsEqual } from "../../utils/path"
324
import { mergePromise, TerminalProcess, TerminalProcessResultPromise } from "./TerminalProcess"
335
import { TerminalInfo, TerminalRegistry } from "./TerminalRegistry"
@@ -89,6 +61,34 @@ Resources:
8961
- https://github.com/microsoft/vscode-extension-samples/blob/main/shell-integration-sample/src/extension.ts
9062
*/
9163

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+
9292
export class TerminalManager {
9393
private terminalIds: Set<number> = new Set()
9494
private processes: Map<number, TerminalProcess> = new Map()

0 commit comments

Comments
 (0)