Skip to content

Commit

Permalink
feat(visual-studio-code-recent-projects): support cursor and vscodium…
Browse files Browse the repository at this point in the history
… properly (#8509)

* feat: support cursor properly

* feat: support vscodium, better getting CLI path

vscodium has a non-standard cli path, so I just removed a function entirely

* chore: lint

* chore: add changelog entry
  • Loading branch information
erics118 authored Oct 3, 2023
1 parent 4a44c74 commit 8d4cfa0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
3 changes: 3 additions & 0 deletions extensions/visual-studio-code-recent-projects/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Visual Studio Code Search Recent Projects Changelog

## [Fix] - 2023-09-22
- Properly support VSCodium and Cursor in for commands relating to extensions

## [Update] - 2023-08-25

- Adds support for Cursor as an option in the extension settings.
Expand Down
27 changes: 13 additions & 14 deletions extensions/visual-studio-code-recent-projects/src/lib/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,19 @@ function getNLSVariable(text: string | undefined): string | undefined {
return m[1];
}
}
const cliPaths: Record<string, string> = {
Code: "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
"Code - Insiders": "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code",
Cursor: "/Applications/Cursor.app/Contents/Resources/app/bin/cursor", // it also has code, which is an alias
VSCodium: "/Applications/VSCodium.app/Contents/Resources/app/bin/codium",
};

export function getVSCodeCLIFilename(): string {
return `/Applications/${getBuildAppName()}.app/Contents/Resources/app/bin/code`;
const name = cliPaths[getBuildNamePreference()];
if (!name || name.length <= 0) {
return cliPaths.Code;
}
return name;
}

export class VSCodeCLI {
Expand Down Expand Up @@ -168,6 +178,8 @@ export function getBuildNamePreference(): string {
const buildSchemes: Record<string, string> = {
Code: "vscode",
"Code - Insiders": "vscode-insiders",
Cursor: "cursor",
VSCodium: "vscode-oss",
};

export function getBuildScheme(): string {
Expand All @@ -177,16 +189,3 @@ export function getBuildScheme(): string {
}
return scheme;
}

const buildAppNames: Record<string, string> = {
Code: "Visual Studio Code",
"Code - Insiders": "Visual Studio Code - Insiders",
};

function getBuildAppName(): string {
const name = buildAppNames[getBuildNamePreference()];
if (!name || name.length <= 0) {
return buildAppNames.Code;
}
return name;
}

0 comments on commit 8d4cfa0

Please sign in to comment.