summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/util/ide.go
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tui/internal/util/ide.go')
-rw-r--r--packages/tui/internal/util/ide.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/tui/internal/util/ide.go b/packages/tui/internal/util/ide.go
new file mode 100644
index 000000000..5d0402b4b
--- /dev/null
+++ b/packages/tui/internal/util/ide.go
@@ -0,0 +1,30 @@
+package util
+
+import (
+ "os"
+ "strings"
+)
+
+var SUPPORTED_IDES = []struct {
+ Search string
+ ShortName string
+}{
+ {"Windsurf", "Windsurf"},
+ {"Visual Studio Code", "VS Code"},
+ {"Cursor", "Cursor"},
+ {"VSCodium", "VSCodium"},
+}
+
+func IsVSCode() bool {
+ return os.Getenv("OPENCODE_CALLER") == "vscode"
+}
+
+func Ide() string {
+ for _, ide := range SUPPORTED_IDES {
+ if strings.Contains(os.Getenv("GIT_ASKPASS"), ide.Search) {
+ return ide.ShortName
+ }
+ }
+
+ return "unknown"
+} \ No newline at end of file