简体   繁体   English

通过 URL 处理打开文件不会在文件自己的工作区中打开文件

[英]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.

相关问题 URL 用于在 WSL 工作区的文件中打开 vscode - URL for opening vscode in file in WSL workspace VSCode 只搜索工作区中打开的文件? [2020] - VSCode only search open files in a workspace ? [2020] Visual Studio Code不记得打开的文件/不记得“打开”文件 - Visual Studio Code doesn't remember opened files / won't remember “open with” files 如何在当前打开的文件夹/工作空间中搜索所有文件? - How to search for all files in the currently open folder / workspace? 在没有最后一个工作区或最后一个文件的情况下重新打开 vscode - re-open vscode without last workspace or last files 仅在 vscode 中打开 vsc-workspace 扩展文件 - Open vsc-workspace extension files in vscode only VSCode 无法在文件资源管理器中打开任何现有文件 - VSCode wan't open any existing file in the files explorer Code-OSS 不会从终端命令“code-oss”打开文件夹或文件。 - Code-OSS doesn't open folder or files from terminal command 'code-oss .' 有没有办法使用 VS Code CLI 打开当前工作区目录中的所有文件? - Is there a way to open all files in a directory in the current workspace using the VS Code CLI? 具有工作空间/文件夹设置的任何方法仅适用于该工作空间/文件夹中的文件,而不适用于工作空间之外的随机文件吗? - Any way to have workspace/folder settings ONLY apply to files in that workspace/folder and not random files outside the workspace?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM