feat(remote): forward ports of a WSL project (#5140)

The Ports tool window existed only for SSH hosts and dev containers; a WSL project refused to forward. A WSL distribution shares this machine's loopback (as `forward_web_url` already assumes), so a port it listens on is reachable here on the same port without a tunnel. The route decision is now a pure `forward_route(target, host)` (SSH channel tunnel, container exec tunnel, or WSL's shared loopback; another host stays reachable from a dev container only), and `Forward::Wsl` reports the port unchanged and owns no resource. The Ports tool window registers for WSL sessions, remembered ports are scoped per distribution and folder (`wsl:<distro>:<root>`), the refusal and its string are gone, and the remote docs describe it.

Co-authored-by: akbar1214 <43771058+akbar1214@users.noreply.github.com>
This commit is contained in:
Akbar Husain
2026-11-22 14:23:05 +08:00
committed by GitHub
parent c57af26f9d
commit 62028362d6
11 changed files with 148 additions and 43 deletions
+2
View File
@@ -106,6 +106,8 @@ Shell。IDE 内置的 SSH 客户端会使用配置里保存的密码、密钥或
打开 `\\wsl.localhost\<distribution>\` 下的文件夹时,也会自动通过该发行版打开。WSL 方式不支持**浏览**。
WSL 窗口中也可以使用**端口**工具窗口。由于发行版与本机的 `localhost` 相通,转发的端口在本机可用同一端口访问;端口的列表、在浏览器中打开和记忆方式与 SSH 相同。
## SSH 配置的其他用途
- **运行目标**(**设置 › 构建、执行、部署 › 运行目标**)可以在 SSH 主机上执行运行配置,见[运行配置](/zh/guide/run)。