创建一个Web浏览器链接,该链接在Intellij中打开文件.可能的? [英] Create a web browser link that opens a file in Intellij. Possible?

查看:260
本文介绍了创建一个Web浏览器链接,该链接在Intellij中打开文件.可能的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,可以使qbittorent打开torrent文件的链接.

Example, qbittorent can be made to open links that are of torrent files.

给客户发送电子邮件至:

Email clients mailto:

是否可以在将在Intellij中打开给定文件的浏览器中创建链接? (不是完整路径,但可能是整个包).

Is it possible to create links in a browser that will open the given file in Intellij? (Not full path, but entire package possibly ).

想法是,这将为bitbucket创建.

Idea is that this will be created for bitbucket.

推荐答案

有一个打开功能请求添加idea://协议处理程序.

There is an open feature request to add idea:// protocol handler.

目前,它仅在开箱即用的macOS上运行.对于其他平台,您可以尝试第三方解决方案或故障单注释中的其他解决方法.

At the moment it works on macOS only out of the box. For other platforms you can try the third-party solution or other workarounds from the ticket comments.

还有一个内置的Web服务器,提供

There is also a built-in web server providing the REST API to open files.

仅当IDE已在运行并且项目打开时,它才可以使用相对路径:http://localhost:63342/api/file/relative/to/module/root/path/to/file.kt.

It will work with the relative paths only when the IDE is already running and the project is open: http://localhost:63342/api/file/relative/to/module/root/path/to/file.kt.

在安装 JetBrains工具箱应用后,您将可以使用jetbrains://协议导航,它正在进行中,应该在 2019.2 中可用.

With the JetBrains Toolbox App installed one will be able to use jetbrains:// protocol for navigation, it's work in progress and should be available in 2019.2.

请参见 JBProtocolNavigateCommand.kt 供参考:

// handles URLs of the following types:

// jetbrains://idea/navigate/reference?project=IDEA
// [&reference[X]=com.intellij.navigation.JBProtocolNavigateCommand[.perform][#perform]]+
// [&path[X]=com/intellij/openapi/project/impl/JBProtocolNavigateCommand.kt[:23[:1]]]+
// [&selection[X]=25:5-26:6]+

示例网址:

jetbrains://idea/navigate/reference?project=IDEA&fqn=com.intellij.openapi.application.JetBrainsProtocolHandler#getParameters

工具箱网址与正则表达式匹配:

Toolbox URL matches regexp:

"${JetBrainsProtocolHandler.PROTOCOL}([\\w\\-]+)/navigate/reference\\?project=(?<project>[\\w]+)(&fqn[\\d]*=(?<fqn>[\\w.\\-#]+))*(&path[\\d]*=(?<path>[\\w-_/\\\\.]+)(:(?<location1>[\\d]+))?(:(?<location2>[\\d]+))?)*(&selection[\\d]*=(?<line1>[\\d]+):(?<column1>[\\d]+)-(?<line2>[\\d]+):(?<column2>[\\d]+))*"

还有一个UI,用于直接从编辑器复制TBX协议URL,类似于上下文菜单中的 Copy Reference 操作.同样适用于IDE设置导航.

There will be also UI for copying TBX protocol URLs directly from the editor similar to the Copy Reference action in the context menu. The same will work for IDE settings navigation.

这篇关于创建一个Web浏览器链接,该链接在Intellij中打开文件.可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆