From 761423b9b219507643f447ab6ab8b37fb4fd6ec2 Mon Sep 17 00:00:00 2001 From: r-uchino Date: Wed, 6 Mar 2024 16:09:58 +0000 Subject: [PATCH 1/3] fix: Use anysphere.open-remote-ssh if it exists for Cursor usage --- src/extension.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 66754b50..014fa856 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,15 +19,18 @@ export async function activate(ctx: vscode.ExtensionContext): Promise { // // 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 msRemoteSSHExtension = vscode.extensions.getExtension("ms-vscode-remote.remote-ssh") + const openRemoteSSHExtension = vscode.extensions.getExtension("anysphere.open-remote-ssh") + if (!msRemoteSSHExtension && !openRemoteSSHExtension) { throw new Error("Remote SSH extension not found") } + // Use "anysphere.open-remote-ssh" if it exists as the cursor is using it + const useRemoteSSHExtension = openRemoteSSHExtension ? openRemoteSSHExtension : msRemoteSSHExtension // 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, ) From 8d115314931c16c3df46cb1415f81a4b7cd82e35 Mon Sep 17 00:00:00 2001 From: r-uchino Date: Wed, 6 Mar 2024 23:48:15 +0000 Subject: [PATCH 2/3] Refactor SSH extension selection logic for priority use of anysphere over ms-vscode --- src/extension.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 014fa856..67dc021e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,13 +19,15 @@ export async function activate(ctx: vscode.ExtensionContext): Promise { // // This is janky, but that's alright since it provides such minimal // functionality to the extension. - const msRemoteSSHExtension = vscode.extensions.getExtension("ms-vscode-remote.remote-ssh") const openRemoteSSHExtension = vscode.extensions.getExtension("anysphere.open-remote-ssh") - if (!msRemoteSSHExtension && !openRemoteSSHExtension) { + // 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. + const useRemoteSSHExtension = openRemoteSSHExtension + ? openRemoteSSHExtension + : vscode.extensions.getExtension("ms-vscode-remote.remote-ssh") + if (!useRemoteSSHExtension) { throw new Error("Remote SSH extension not found") } - // Use "anysphere.open-remote-ssh" if it exists as the cursor is using it - const useRemoteSSHExtension = openRemoteSSHExtension ? openRemoteSSHExtension : msRemoteSSHExtension // eslint-disable-next-line @typescript-eslint/no-explicit-any const vscodeProposed: typeof vscode = (module as any)._load( "vscode", From 541385afcfb756c39d65fb987933323dcf10c0c0 Mon Sep 17 00:00:00 2001 From: r-uchino Date: Thu, 7 Mar 2024 00:03:56 +0000 Subject: [PATCH 3/3] fix: This adjustment explicitly notes in the comments that it is for non-official VS Code distributions. --- src/extension.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extension.ts b/src/extension.ts index 67dc021e..dee950d5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -22,6 +22,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise { 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")