Intellij-如何制作一个可以通过CLI或Web服务执行IDE动作的插件? [英] Intellij - how to make a plugin that can perform IDE actions via a CLI or web service?

查看:132
本文介绍了Intellij-如何制作一个可以通过CLI或Web服务执行IDE动作的插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助来开始制作特定的IntelliJ插件.

I need some help getting started making a specific IntelliJ plugin.

我想制作一个IntelliJ插件,以便您可以从CLI(或从Web服务开始,如果更简单)启动intelliJ动作.

I want to make an IntelliJ plugin that makes it so you can launch intelliJ actions from CLI (or from a web service if it's easier).

例如,我已经完成了使用gradle脚本构建项目的工作……但是我也想在intelliJ中准备好它.现在,我必须通过点击手动进行此操作.

For example, I'm done building my project with a gradle script... but i want to get it ready in intelliJ too. Right now I have to do this manually with a point-and-clicks.

相反,我希望具有从外部触发某些IntelliJ命令的功能.在我的示例中,我想从我的gradle脚本中触发这些请求:

Instead I want to have this the ability to externally trigger some IntelliJ commands. In my example I would want to fire off these requests from my gradle script:

  • run-intellij-command {project-path} --action refresh-gradle
  • run-intellij-command {project-path} --action build-project
  • run-intellij-command {project-path} --action start-debugging --configurationName={configuration-name}
  • run-intellij-command {project-path} --action refresh-gradle
  • run-intellij-command {project-path} --action build-project
  • run-intellij-command {project-path} --action start-debugging --configurationName={configuration-name}

有没有人举过我如何入门的例子?

Does anyone have an example of how I can get started with this?

真的希望有一个intellij插件项目,该项目已经在执行类似的操作,例如对cli命令做出反应或托管可被调用的Web服务吗?

Really hoping there is an intellij plugin project that already does something similar like reacting to cli commands or hosts a web service that can be called?

谢谢!

还创建了此 https://youtrack.jetbrains.com/issue/IDEA-184885 希望有一天能实现此功能

Also created this https://youtrack.jetbrains.com/issue/IDEA-184885 hoping to see this feature become a reality some day

推荐答案

您可以使用

You can use the ApplicationStarterEx interface to implement that. Provide a class implementing the interface, and register it in your plugin.xml as the <appStarter> extension point.

要执行代码,请使用工具" |命令".创建命令行启动器,然后从命令行运行idea <startername> <arguments>,其中startername是从ApplicationStarter.getCommandName()返回的内容.

To execute your code, use Tools | Create Command-line Launcher, and then run idea <startername> <arguments> from the command line, where startername is what you return from ApplicationStarter.getCommandName().

我不知道任何实现类似功能的现有开源插件.

I'm not aware of any existing open-source plugins that implement similar functionality.

这篇关于Intellij-如何制作一个可以通过CLI或Web服务执行IDE动作的插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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