Add toggleable IDE mode setting (#5146)

This commit is contained in:
christine betts
2025-07-30 22:36:24 +00:00
committed by GitHub
parent ac1bb5ee42
commit 325bb89137
13 changed files with 231 additions and 123 deletions

View File

@@ -41,14 +41,14 @@ export class IdeClient {
private readonly currentIde: DetectedIde | undefined;
private readonly currentIdeDisplayName: string | undefined;
private constructor(ideMode: boolean) {
if (!ideMode) {
return;
}
constructor(ideMode: boolean) {
this.currentIde = detectIde();
if (this.currentIde) {
this.currentIdeDisplayName = getIdeDisplayName(this.currentIde);
}
if (!ideMode) {
return;
}
this.init().catch((err) => {
logger.debug('Failed to initialize IdeClient:', err);
});
@@ -130,6 +130,10 @@ export class IdeClient {
};
}
async reconnect(ideMode: boolean) {
IdeClient.instance = new IdeClient(ideMode);
}
private async establishConnection(port: string) {
let transport: StreamableHTTPClientTransport | undefined;
try {
@@ -189,7 +193,15 @@ export class IdeClient {
await this.establishConnection(port);
}
dispose() {
this.client?.close();
}
getDetectedIdeDisplayName(): string | undefined {
return this.currentIdeDisplayName;
}
setDisconnected() {
this.setState(IDEConnectionStatus.Disconnected);
}
}