[英]Opening files through URL handling doesn't open file in files own workspace
I am trying to open VS Code from my web app through URL handling.我正在尝试通过 URL 处理从我的 web 应用程序打开 VS Code。 I found the PR URL handling has been implemented and merged on GitHub .
我发现 PR URL 处理已在GitHub上实施和合并。 What I am trying to do is to open a file in its workspace.
我想做的是在其工作区中打开一个文件。 I found that with the current implementation it is not possible to do that since only the file and the lines parsed from the URL with this format
vscode://file/%%f:%%l
.我发现使用当前的实现不可能做到这一点,因为只有文件和从 URL 解析的行格式
vscode://file/%%f:%%l
。
In the PR it's been said that the opening behavior is the same as running code -g -r /path/to/file
on local machine.在 PR 中,据说打开行为与在本地机器上运行
code -g -r /path/to/file
相同。 But running this script opens the file in its workspace if the workspace is already opened on VS Code.但是,如果工作区已在 VS Code 上打开,则运行此脚本会在其工作区中打开文件。 Doesn't matter if it is focused or not, if that workspace somehow opened, VS Code opens the file in its original workspace.
不管它是否集中,如果该工作区以某种方式打开,VS Code 会在其原始工作区中打开文件。
I believe VS Code folks are doing great job.我相信 VS Code 的人做得很好。 Am I missing something here or local script and URL handling just behaves differently than I experienced.
我在这里遗漏了什么还是本地脚本和 URL 处理的行为与我经历的不同。
BTW I tried almost all versions of VS Code after September 2017.顺便说一句,我在 2017 年 9 月之后尝试了几乎所有版本的 VS Code。
VSCode 1.43 (Q1 2020) might improve those protocol links by adding the possibility to open folders and workspace. VSCode 1.43(2020 年第一季度)可能会通过增加打开文件夹和工作区的可能性来改进这些协议链接。
For a while, VSCode supported to open files through protocol links (eg
vscode://file/<file-path>
).有一段时间,VSCode 支持通过协议链接打开文件(例如
vscode://file/<file-path>
)。
In this milestone, we expanded the support to include opening folders or workspaces .在这个里程碑中,我们扩展了支持以包括打开文件夹或工作区。
The syntax is the same:
语法是一样的:
vscode://file/<path> vscode-insiders://file/<path>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.