Skip to content

Commit e4af994

Browse files
authored
Merge pull request #253 from brevdev/cursor-ext-mapping
vscode ext ID mapping to cursor ext ID mapping for brev open cursor
2 parents 8892b75 + a760453 commit e4af994

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

pkg/util/util.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,19 @@ func IsCursorExtensionInstalled(extensionID string) (bool, error) {
120120
if err != nil {
121121
return false, breverrors.WrapAndTrace(err)
122122
}
123-
return strings.Contains(string(out), extensionID), nil
123+
124+
// Check for the original extension ID
125+
if strings.Contains(string(out), extensionID) {
126+
return true, nil
127+
}
128+
129+
// Check for Cursor-specific extension ID mappings
130+
cursorEquivalent := mapVSCodeToCursorExtension(extensionID)
131+
if cursorEquivalent != "" && strings.Contains(string(out), cursorEquivalent) {
132+
return true, nil
133+
}
134+
135+
return false, nil
124136
}
125137

126138
func InstallWindsurfExtension(extensionID string) error {
@@ -268,3 +280,12 @@ var commonWindsurfPaths = []string{
268280
"/usr/local/share/windsurf/bin/windsurf",
269281
"/usr/share/windsurf/bin/windsurf",
270282
}
283+
284+
// mapVSCodeToCursorExtension maps VSCode extension IDs to their Cursor equivalents
285+
func mapVSCodeToCursorExtension(vscodeExtensionID string) string {
286+
cursorMappings := map[string]string{
287+
"ms-vscode-remote.remote-ssh": "anysphere.remote-ssh",
288+
// Add more mappings here as we discover them
289+
}
290+
return cursorMappings[vscodeExtensionID]
291+
}

pkg/util/util_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,13 @@ func TestBasePath(t *testing.T) {
2121
b := RemoveFileExtenstion(x)
2222
assert.Equal(t, "abc/setup", b)
2323
}
24+
25+
func TestMapVSCodeToCursorExtension(t *testing.T) {
26+
// Test known mapping
27+
result := mapVSCodeToCursorExtension("ms-vscode-remote.remote-ssh")
28+
assert.Equal(t, "anysphere.remote-ssh", result)
29+
30+
// Test unknown extension (should return empty string)
31+
result = mapVSCodeToCursorExtension("unknown.extension")
32+
assert.Equal(t, "", result)
33+
}

0 commit comments

Comments
 (0)