Skip to content

Enhancing SSH Connection Compatibility with Cursor #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
//
// This is janky, but that's alright since it provides such minimal
// functionality to the extension.
const remoteSSHExtension = vscode.extensions.getExtension("ms-vscode-remote.remote-ssh")
if (!remoteSSHExtension) {
const openRemoteSSHExtension = vscode.extensions.getExtension("anysphere.open-remote-ssh")
// If the "anysphere.open-remote-ssh" extension is available, it is used with priority
// If it is not found, then the extension "ms-vscode-remote.remote-ssh" is sought as a fallback.
// This is specifically for non-official VS Code distributions, such as Cursor.
const useRemoteSSHExtension = openRemoteSSHExtension
? openRemoteSSHExtension
: vscode.extensions.getExtension("ms-vscode-remote.remote-ssh")
if (!useRemoteSSHExtension) {
throw new Error("Remote SSH extension not found")
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const vscodeProposed: typeof vscode = (module as any)._load(
"vscode",
{
filename: remoteSSHExtension?.extensionPath,
filename: useRemoteSSHExtension?.extensionPath,
},
false,
)
Expand Down