fix(editor): distinguish SSH remote files from folders - #565
Open
wang-kaopu wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
修复 SSH Remote 场景下「在应用中打开」无法正确打开文件的问题,对应 #564。
此前 #522 已将 VS Code / Cursor 等 VSCode-family 的 SSH Remote 链接从 DSH 服务端转移到浏览器客户端执行,解决了无头远程服务器无法处理
vscode:///cursor://协议的问题。但该修复没有保留文件与目录的资源类型语义。对于vscode://vscode-remote/ssh-remote+<host>/<path>VS Code 会将没有显式文件定位信息的远程路径按目录处理,因此目录能够正常打开,而普通文件(尤其无扩展名文件)会被错误地作为目录打开。
本 PR 补全文件 / 目录语义:
:1:1,显式触发 VS Code Remote 的 file / goto 语义/,继续按 folder 语义打开FileTree利用已有的isDir信息,在进入 URL opener 前保留资源类型reveal仍使用原始路径,不受 URL 路径规范化影响例如:
问题原因
VS Code 对
vscode://vscode-remote/...的协议 URL 会区分 remote file 与 remote folder。此前生成的文件 URL:没有携带文件定位语义,会被 VS Code 按远程目录处理。#522 解决的是「协议由客户端还是服务端执行」的问题,现在进一步解决「客户端收到协议后按文件还是目录解释」的问题。
测试
补充 / 更新回归测试,覆盖:
:1:1文件 URL//已实际运行:
pnpm test测试通过。
范围说明
本 PR 仅修复 DSH-better-sidebar 仓库侧的 SSH Remote 文件 / 目录 URL 构建逻辑,不修改 DSH 源码,也不改变现有 host/client opener 分流设计。
Fixes #564