RemotePathMap中文说明(点击展开)RemotePathMap 是一个运行在本地 UI 侧的 VS Code 扩展,用于在远程 SSH 或 WSL 开发时,把远程工作区路径映射到本地目录,并从资源管理器右键直接定位到映射后的本地文件或文件夹。 解决的问题在 Remote SSH / WSL 窗口里,资源管理器右键的“在文件资源管理中显示”通常无法直接定位到本机文件系统。如果你已经把远程项目同步、挂载或映射到了本地目录,这个扩展可以在右键菜单里补上一条可用的本地定位入口。 工作方式
配置项中文配置:remotePathMap.workspaceMappings当前远程工作区文件夹使用的映射,适合只对该工作区文件夹生效的场景。 中文配置:remotePathMap.globalMappings本机用户设置中的全局映射,适合同一远程 authority 和远程根路径在多个工作区重复使用的场景。 映射结构
说明:VS Code 对远程连接稳定暴露的是 authority,例如 ssh-remote+主机别名 或 wsl+发行版。它不一定能提供原始 IP,因此全局映射采用 authority + 远程工作区根路径作为匹配键。 本地路径选择说明配置映射时,扩展会先让你输入要映射的远程根路径,再要求你提供本地根路径。这样可以把当前工作区文件夹、当前子目录,或整个远程根目录(例如 /)映射到本地。 在某些远程窗口里,VS Code 的目录选择器可能返回远程 URI,而不是本地文件系统路径。为避免把远程路径误写到本地映射配置中,RemotePathMap 提供两种本地路径输入方式:
当目录选择器没有返回本地路径时,扩展会提示你改用手动输入。 调试
测试执行 npm test 可以运行路径映射相关的单元测试。 打包与发布
RemotePathMap is a VS Code UI extension that runs locally. It maps remote SSH or WSL workspace paths to local folders and lets you reveal the mapped local file or folder from Explorer. Problem SolvedIn Remote SSH or WSL windows, the built-in Reveal in File Explorer action often cannot locate the corresponding path on the local machine. If you already mirror, mount, or sync the remote project to a local directory, this extension adds a usable Explorer context action for that local path. How It Works
SettingsremotePathMap.workspaceMappingsMappings for the current remote workspace folder. Use this when a mapping should apply only to that workspace folder. remotePathMap.globalMappingsMappings stored in local user settings on this machine. Use this when the same remote authority and remote root should be reused across multiple workspaces. Mapping Shape
VS Code reliably exposes the remote authority, for example ssh-remote+host-alias or wsl+distribution. It does not always expose the raw IP, so global mappings use authority plus remote workspace root as the matching key. Local Path SelectionDuring mapping setup, the extension first asks for the remote root path and then for the local root path. This allows you to map the current workspace folder, a subdirectory, or the entire remote root such as /. In some remote windows, the folder picker may return a remote URI instead of a local file-system path. To prevent a remote path from being stored as a local mapping, RemotePathMap provides two ways to enter the local root:
If the picker does not return a local path, the extension prompts you to switch to manual input. Debugging
TestingRun npm test to execute the path mapping unit tests. Packaging And Publishing
|