Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>RemotePathMapNew to Visual Studio Code? Get it now.
RemotePathMap

RemotePathMap

easyatm

| (0) | Free
Map remote SSH workspace paths to local folders and reveal the mapped location from Explorer.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

RemotePathMap

中文说明(点击展开)

RemotePathMap 是一个运行在本地 UI 侧的 VS Code 扩展,用于在远程 SSH 或 WSL 开发时,把远程工作区路径映射到本地目录,并从资源管理器右键直接定位到映射后的本地文件或文件夹。

解决的问题

在 Remote SSH / WSL 窗口里,资源管理器右键的“在文件资源管理中显示”通常无法直接定位到本机文件系统。如果你已经把远程项目同步、挂载或映射到了本地目录,这个扩展可以在右键菜单里补上一条可用的本地定位入口。

工作方式

  • 扩展声明为 UI 扩展,运行在本地。
  • 仅对远程资源显示右键菜单项。
  • 资源管理器右键菜单和文件标签页右键菜单都会显示命令。
  • 通过远程资源的 authority 和远程工作区根路径建立映射。
  • 已存在映射时,右键显示“在文件资源管理中显示[映射]”。
  • 当映射结果是具体文件时,Windows 和 macOS 会尽量在系统文件管理器中选中文件名;如果是目录,则直接打开该目录。
  • 尚未配置映射时,右键显示“在文件资源管理中显示[需要配置]”,点击后会依次引导你配置远程路径和本地路径。

配置项

中文配置:remotePathMap.workspaceMappings

当前远程工作区文件夹使用的映射,适合只对该工作区文件夹生效的场景。

中文配置:remotePathMap.globalMappings

本机用户设置中的全局映射,适合同一远程 authority 和远程根路径在多个工作区重复使用的场景。

映射结构

[
  {
    "remoteAuthority": "ssh-remote+dev-server",
    "remoteWorkspaceFolder": "/srv/project",
    "localWorkspaceFolder": "D:\\mirror\\project",
    "description": "可选说明"
  }
]

说明:VS Code 对远程连接稳定暴露的是 authority,例如 ssh-remote+主机别名 或 wsl+发行版。它不一定能提供原始 IP,因此全局映射采用 authority + 远程工作区根路径作为匹配键。

本地路径选择说明

配置映射时,扩展会先让你输入要映射的远程根路径,再要求你提供本地根路径。这样可以把当前工作区文件夹、当前子目录,或整个远程根目录(例如 /)映射到本地。

在某些远程窗口里,VS Code 的目录选择器可能返回远程 URI,而不是本地文件系统路径。为避免把远程路径误写到本地映射配置中,RemotePathMap 提供两种本地路径输入方式:

  • 浏览本地目录
  • 手动输入本地绝对路径

当目录选择器没有返回本地路径时,扩展会提示你改用手动输入。

调试

  1. 执行 npm install。
  2. 按 F5,选择“运行 RemotePathMap 扩展”。
  3. 在新的扩展开发宿主窗口里打开一个 Remote SSH 或 WSL 工作区进行验证。

测试

执行 npm test 可以运行路径映射相关的单元测试。

打包与发布

  • 执行 npm run package:extension 生成 VSIX 安装包。
  • 执行 npm run publish:extension 发布扩展到 Marketplace。

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 Solved

In 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

  • The extension runs as a UI extension on the local side.
  • Explorer context menu entries appear only for remote resources.
  • The command is available from both Explorer context menus and editor tab context menus.
  • Mappings are matched by remote authority plus remote workspace root path.
  • When a matching mapping exists, the context menu shows Reveal in File Explorer [Mapped].
  • When the mapped target is a file, Windows and macOS try to reveal and select the file in the system file manager; when it is a directory, the directory is opened directly.
  • When no mapping is configured yet, the context menu shows Reveal in File Explorer [Setup Required], then guides you through remote path and local path setup.

Settings

remotePathMap.workspaceMappings

Mappings for the current remote workspace folder. Use this when a mapping should apply only to that workspace folder.

remotePathMap.globalMappings

Mappings 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

[
  {
    "remoteAuthority": "ssh-remote+dev-server",
    "remoteWorkspaceFolder": "/srv/project",
    "localWorkspaceFolder": "D:\\mirror\\project",
    "description": "Optional note"
  }
]

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 Selection

During 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:

  • Browse local folder
  • Enter the local absolute path manually

If the picker does not return a local path, the extension prompts you to switch to manual input.

Debugging

  1. Run npm install.
  2. Press F5 and choose 运行 RemotePathMap 扩展.
  3. In the Extension Development Host window, open a Remote SSH or WSL workspace and verify the Explorer context menu flow.

Testing

Run npm test to execute the path mapping unit tests.

Packaging And Publishing

  • Run npm run package:extension to generate a VSIX package.
  • Run npm run publish:extension to publish the extension to the Marketplace.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft