@@ -4,26 +4,19 @@ import { TrimmedNonEmptyString } from "./baseSchemas.ts";
44export const EditorLaunchStyle = Schema . Literals ( [ "direct-path" , "goto" , "line-column" ] ) ;
55export type EditorLaunchStyle = typeof EditorLaunchStyle . Type ;
66
7- /** Deep-link shapes editors use to open a remote workspace over SSH. */
8- export type EditorRemoteLinkStyle = "vscode-remote" | "zed-ssh" ;
9-
107type EditorDefinition = {
118 readonly id : string ;
129 readonly label : string ;
1310 readonly commands : readonly [ string , ...string [ ] ] | null ;
1411 readonly baseArgs ?: readonly string [ ] ;
1512 readonly launchStyle : EditorLaunchStyle ;
1613 /**
17- * URL scheme for editors that can open a remote workspace over SSH. Only set
18- * for editors that ship the remote machinery; see `remoteLinkStyle` for the
19- * shape of the link the scheme expects.
14+ * URL scheme for editors that support VS Code's remote deep links
15+ * (`<scheme>://vscode-remote/ssh-remote+<host><path>`). Only set for VS Code
16+ * and forks that ship the Remote-SSH machinery, plus Zed, which uses its own
17+ * `zed://ssh/<host><path>` shape.
2018 */
2119 readonly remoteScheme ?: string ;
22- /**
23- * Shape of `remoteScheme`'s deep link. Defaults to VS Code's
24- * `<scheme>://vscode-remote/ssh-remote+<host><path>`, which its forks share.
25- */
26- readonly remoteLinkStyle ?: EditorRemoteLinkStyle ;
2720} ;
2821
2922export const EDITORS = [
@@ -63,7 +56,6 @@ export const EDITORS = [
6356 commands : [ "zed" , "zeditor" ] ,
6457 launchStyle : "direct-path" ,
6558 remoteScheme : "zed" ,
66- remoteLinkStyle : "zed-ssh" ,
6759 } ,
6860 { id : "antigravity" , label : "Antigravity" , commands : [ "agy" ] , launchStyle : "goto" } ,
6961 { id : "idea" , label : "IntelliJ IDEA" , commands : [ "idea" ] , launchStyle : "line-column" } ,
@@ -99,10 +91,7 @@ export type LaunchEditorInput = typeof LaunchEditorInput.Type;
9991
10092const remoteSchemeOf = ( editor : EditorDefinition ) : string | undefined => editor . remoteScheme ;
10193
102- const remoteLinkStyleOf = ( editor : EditorDefinition ) : EditorRemoteLinkStyle | undefined =>
103- editor . remoteScheme === undefined ? undefined : ( editor . remoteLinkStyle ?? "vscode-remote" ) ;
104-
105- /** Editors that can open a remote workspace via an SSH deep link. */
94+ /** Editors that can open a remote workspace via `vscode-remote` deep links. */
10695export const REMOTE_CAPABLE_EDITOR_IDS : ReadonlyArray < EditorId > = EDITORS . flatMap ( ( editor ) =>
10796 remoteSchemeOf ( editor ) !== undefined ? [ editor . id ] : [ ] ,
10897) ;
@@ -112,35 +101,27 @@ export const remoteSchemeForEditor = (id: EditorId): string | undefined => {
112101 return editor === undefined ? undefined : remoteSchemeOf ( editor ) ;
113102} ;
114103
115- /** Link shape `remoteSchemeForEditor` returns a scheme for, if any. */
116- export const remoteLinkStyleForEditor = ( id : EditorId ) : EditorRemoteLinkStyle | undefined => {
117- const editor = EDITORS . find ( ( candidate ) => candidate . id === id ) ;
118- return editor === undefined ? undefined : remoteLinkStyleOf ( editor ) ;
119- } ;
120-
121104/**
122- * Builds the deep link that opens `absolutePath` on ` host` in the local editor
123- * over SSH: `<scheme> ://vscode-remote/ ssh-remote+ <host><path>` for VS Code and
124- * its forks, `zed://ssh/<host><path>` for Zed . Returns undefined for editors
125- * without remote deep-link support.
105+ * Builds a `<scheme>://vscode-remote/ssh-remote+< host><path>` deep link (Zed
106+ * takes `zed ://ssh/ <host><path>`) that opens `absolutePath` on `host` in the
107+ * local editor over SSH . Returns undefined for editors without remote
108+ * deep-link support.
126109 */
127110export const buildRemoteOpenUrl = ( input : {
128111 readonly editor : EditorId ;
129112 readonly host : string ;
130113 readonly absolutePath : string ;
131114} ) : string | undefined => {
132115 const scheme = remoteSchemeForEditor ( input . editor ) ;
133- const style = remoteLinkStyleForEditor ( input . editor ) ;
134- if ( scheme === undefined || style === undefined ) {
116+ if ( scheme === undefined ) {
135117 return undefined ;
136118 }
137- // Windows server paths (`C:\...`) appear as `/C:/...` in the remote URI, and
138- // percent-encoding keeps the drive colon out of Zed's SCP-style host split.
119+ // Windows server paths (`C:\...`) appear as `/C:/...` in vscode-remote URIs.
139120 const posixPath = input . absolutePath . replaceAll ( "\\" , "/" ) ;
140121 const rootedPath = posixPath . startsWith ( "/" ) ? posixPath : `/${ posixPath } ` ;
141122 const encodedPath = rootedPath . split ( "/" ) . map ( encodeURIComponent ) . join ( "/" ) ;
142123 const encodedHost = encodeURIComponent ( input . host ) ;
143- return style === "zed-ssh "
124+ return input . editor === "zed"
144125 ? `${ scheme } ://ssh/${ encodedHost } ${ encodedPath } `
145126 : `${ scheme } ://vscode-remote/ssh-remote+${ encodedHost } ${ encodedPath } ` ;
146127} ;
0 commit comments