@@ -91,7 +91,7 @@ export type LaunchEditorInput = typeof LaunchEditorInput.Type;
9191
9292const remoteSchemeOf = ( editor : EditorDefinition ) : string | undefined => editor . remoteScheme ;
9393
94- /** Editors that can open a remote workspace via `vscode-remote` deep links . */
94+ /** Editors that can open a remote workspace via an SSH deep link . */
9595export const REMOTE_CAPABLE_EDITOR_IDS : ReadonlyArray < EditorId > = EDITORS . flatMap ( ( editor ) =>
9696 remoteSchemeOf ( editor ) !== undefined ? [ editor . id ] : [ ] ,
9797) ;
@@ -119,11 +119,18 @@ export const buildRemoteOpenUrl = (input: {
119119 // Windows server paths (`C:\...`) appear as `/C:/...` in vscode-remote URIs.
120120 const posixPath = input . absolutePath . replaceAll ( "\\" , "/" ) ;
121121 const rootedPath = posixPath . startsWith ( "/" ) ? posixPath : `/${ posixPath } ` ;
122- const encodedPath = rootedPath . split ( "/" ) . map ( encodeURIComponent ) . join ( "/" ) ;
123122 const encodedHost = encodeURIComponent ( input . host ) ;
124- return input . editor === "zed"
125- ? `${ scheme } ://ssh/${ encodedHost } ${ encodedPath } `
126- : `${ scheme } ://vscode-remote/ssh-remote+${ encodedHost } ${ encodedPath } ` ;
123+ if ( input . editor === "zed" ) {
124+ // Zed's remote server resolves a rooted path on the system drive, so a
125+ // Windows `C:\Users\x` must become `/Users/x` (verified in #8938). Other
126+ // drives are untested and kept as is rather than silently remapped, and a
127+ // POSIX path that happens to start with `/C:` is left alone.
128+ const zedPath = / ^ [ C c ] : [ \\ / ] / . test ( input . absolutePath ) ? rootedPath . slice ( 3 ) : rootedPath ;
129+ const encodedZedPath = zedPath . split ( "/" ) . map ( encodeURIComponent ) . join ( "/" ) ;
130+ return `${ scheme } ://ssh/${ encodedHost } ${ encodedZedPath } ` ;
131+ }
132+ const encodedPath = rootedPath . split ( "/" ) . map ( encodeURIComponent ) . join ( "/" ) ;
133+ return `${ scheme } ://vscode-remote/ssh-remote+${ encodedHost } ${ encodedPath } ` ;
127134} ;
128135
129136/**
0 commit comments