From fcae48db01ccef2ce63dca06f0b306b57c1af8ef Mon Sep 17 00:00:00 2001 From: Andrew Churchill Date: Fri, 20 Mar 2026 17:04:01 -0700 Subject: [PATCH 1/2] Load custom VSCode names from config file --- agent-support/vscode/src/utils/host-kind.ts | 28 ++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/agent-support/vscode/src/utils/host-kind.ts b/agent-support/vscode/src/utils/host-kind.ts index b1cb5ae08..9cfb5a864 100644 --- a/agent-support/vscode/src/utils/host-kind.ts +++ b/agent-support/vscode/src/utils/host-kind.ts @@ -1,4 +1,6 @@ import * as vscode from "vscode"; +import * as fs from "node:fs"; +import * as os from "node:os"; import * as path from "node:path"; export type IDEHostConfiguration = { @@ -19,6 +21,22 @@ export type IDEHostKind = | typeof IDEHostKindVSCode | typeof IDEHostKindUnknown; +/** + * Loads the list of IDE names that should be treated as VSCode by checking the configuration file. + */ +function loadVscodeIdeNames(): string[] { + try { + const filePath = path.join(os.homedir(), ".git-ai", "VSCODE_IDE_NAMES"); + const content = fs.readFileSync(filePath, "utf-8"); + return content + .split("\n") + .map((line: string) => line.trim().toLowerCase()) + .filter((line: string) => line.length > 0); + } catch { + return []; + } +} + export function detectIDEHost(): IDEHostConfiguration { const appName = (vscode.env.appName ?? "").toLowerCase(); const uriScheme = (vscode.env.uriScheme ?? "").toLowerCase(); @@ -26,11 +44,19 @@ export function detectIDEHost(): IDEHostConfiguration { const has = (s: string) => appName.includes(s) || uriScheme === s || execPath.includes(`${path.sep}${s}`); - const kind: IDEHostKind = + let kind: IDEHostKind = has("cursor") ? "cursor" : has("windsurf") ? "windsurf" : has("vscodium") || uriScheme === "vscode-insiders" || uriScheme === "vscode" || appName.includes("visual studio code") ? "vscode" : "unknown"; + // If we don't recognize the IDE, check if it's a custom VSCode-like IDE that should be treated as VSCode by checking the configuration file. + if (kind === "unknown") { + const vscodeIdeNames = loadVscodeIdeNames(); + if (vscodeIdeNames.some(has)) { + kind = "vscode"; + } + } + return { kind, appName: vscode.env.appName, uriScheme: vscode.env.uriScheme, execPath: process.execPath }; } From 327447d78c1dd0e97d4a677ad08da6e266d5053a Mon Sep 17 00:00:00 2001 From: Andrew Churchill Date: Fri, 20 Mar 2026 17:07:51 -0700 Subject: [PATCH 2/2] add logging --- agent-support/vscode/src/utils/host-kind.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/agent-support/vscode/src/utils/host-kind.ts b/agent-support/vscode/src/utils/host-kind.ts index 9cfb5a864..34b82c6b2 100644 --- a/agent-support/vscode/src/utils/host-kind.ts +++ b/agent-support/vscode/src/utils/host-kind.ts @@ -53,9 +53,15 @@ export function detectIDEHost(): IDEHostConfiguration { // If we don't recognize the IDE, check if it's a custom VSCode-like IDE that should be treated as VSCode by checking the configuration file. if (kind === "unknown") { const vscodeIdeNames = loadVscodeIdeNames(); - if (vscodeIdeNames.some(has)) { - kind = "vscode"; + if (vscodeIdeNames.length > 0) { + console.log('[git-ai] Checking for VSCode-like IDE: ', vscodeIdeNames); + if (vscodeIdeNames.some(has)) { + kind = "vscode"; + console.log('[git-ai] Found VSCode-like IDE: ', kind); + } } + } else { + console.log('[git-ai] Recognized IDE: ', kind); } return { kind, appName: vscode.env.appName, uriScheme: vscode.env.uriScheme, execPath: process.execPath };