插件配置文件

走着路睡觉大约 3 分钟

插件配置文件

plugin.xml 配置文件详情如下:

<!-- url 是可选的,会在页面显示插件的home -->
<idea-plugin url="https://example.com/my-plugin-site">

  <!--
  插件的唯一id,应该设置为全限定名称,不能和其它插件冲突,
  在更新插件版本的时候,不能修改id,
  如果不设置,会使用name(不推荐) 
  -->
  <id>com.example.myplugin</id>
  <!--  插件名称  -->
  <name>My Framework Support</name>
  <!-- 插件版本,可以去 https://jubianchi.github.io/semver-check 检查自己的版本号是否合规  -->
  <version>1.0.0</version>
    <!-- 作者信息,url是作者homepage -->
  <vendor
      url="https://plugins.jetbrains.com/my-company"
      email="contact@example.com">My Company</vendor>

  <!--
  收费插件需要用到,免费插件不需要配置,也可以在收费插件中设置免费功能,了解更多查看 https://plugins.jetbrains.com/build-and-market
  -->
  <product-descriptor
      code="PMYPLUGIN"
      release-date="20210901"
      release-version="20211"
      optional="true"/>

  <!-- 限制idea版本,在idea哪些版本中可以使用,可以不设置,默认跟 build.gradle中定义的intellij.version的限制相同 -->
  <idea-version since-build="193" until-build="193.*"/>
  <!--
  idea的介绍,可以使用html标签,如果使用html标签,必须用 <![CDATA[ ]]> 包装 ,了解更多 https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-description
  -->
  <description>
  <![CDATA[
    Provides support for <a href="https://example.com/my-framework">My
    Framework</a>.
    <p>Includes support for:
    <ul>
      <li>code completion</li>
      <li>references</li>
      <li>refactoring</li>
    </ul>
    </p>
  ]]>
  </description>
    <!-- 描述新版本的功能,可以使用html标签,如果使用html标签,必须用 <![CDATA[ ]]> 包装  -->
  <change-notes>Initial release of the plugin.</change-notes>

    <!--为IDE指定需要依赖的其它插件或模块 ,如果目标IDE不包含该依赖,插件不能正常运行-->
  <depends>com.intellij.modules.platform</depends>
  <depends>com.example.third-party-plugin</depends>
    <!--可选的,如果安装了com.example.my-second-plugin插件,mysecondplugin.xml(格式和plugin.xml一样)配置才会加载 -->
  <depends
      optional="true"
      config-file="mysecondplugin.xml">com.example.my-second-plugin</depends>

  <!--
  加载配置文件,下面配置表示 /messages/MyPluginBundle.properties 会被加载,  "action.[ActionID].text|description" 中的ActionID可以使用,
  https://www.ideaplugin.com/idea-docs/Part%20I%20%E6%8F%92%E4%BB%B6/PluginStructure/Extension%20Points.html#%E7%A4%BA%E4%BE%8B 中的 带 @Attribute注解的成员变量也可以用 
  -->
  <resource-bundle>messages.MyPluginBundle</resource-bundle>

  <!--
  定义扩展点,其它插件可以通过这个扩展点来提供某些数据
  https://www.ideaplugin.com/idea-docs/Part%20I%20%E6%8F%92%E4%BB%B6/PluginStructure/Extension%20Points.html
  -->
  <extensionPoints>
    <extensionPoint
        name="testExtensionPoint"
        beanClass="com.example.impl.MyExtensionBean"/>
    <applicationService
        serviceImplementation="com.example.impl.MyApplicationService"/>
    <projectService
        serviceImplementation="com.example.impl.MyProjectService"/>
  </extensionPoints>

  <!--
  Application-level 应用级的监听器. 
  https://www.ideaplugin.com/idea-docs/Part%20I%20插件/PluginStructure/Listeners.html#注册应用级-application-level-监听器
  -->
  <applicationListeners>
    <listener
        class="com.example.impl.MyListener"
        topic="com.intellij.openapi.vfs.newvfs.BulkFileListener"/>
  </applicationListeners>

  <!--
 Project-level 项目级的监听器. 
  https://www.ideaplugin.com/idea-docs/Part%20I%20插件/PluginStructure/Listeners.html#注册项目级-project-level-监听器
  -->
  <projectListeners>
    <listener
        class="com.example.impl.MyToolwindowListener"
        topic="com.intellij.openapi.wm.ex.ToolWindowManagerListener"/>
  </projectListeners>

  <!--
  Actions 操作. 了解更多,请看:
  https://www.ideaplugin.com/idea-docs/Part%20II%20%E2%80%94%20Base%20Platform/Actions/
  -->
  <actions>
    <action
        id="VssIntegration.GarbageCollection"
        class="com.example.impl.CollectGarbage"
        text="Collect _Garbage"
        description="Run garbage collector">
      <keyboard-shortcut
          first-keystroke="control alt G"
          second-keystroke="C"
          keymap="$default"/>
    </action>
  </actions>

    <!--  自定义扩展   https://www.ideaplugin.com/idea-docs/Part%20I%20%E6%8F%92%E4%BB%B6/PluginStructure/Extensions.html  -->
  <extensions defaultExtensionNs="VssIntegration">
    <myExtensionPoint implementation="com.example.impl.MyExtensionImpl"/>
  </extensions>


  <!--
  已经弃用,替代方案 https://www.ideaplugin.com/idea-docs/Part%20I%20%E6%8F%92%E4%BB%B6/PluginStructure/Components.html
  -->
  <application-components>
    <component>
      <!-- Component's interface class -->
      <interface-class>com.example.Component1Interface</interface-class>
      <!-- Component's implementation class -->
      <implementation-class>com.example.impl.Component1Impl</implementation-class>
    </component>
  </application-components>

  <!--
  已经弃用,替代方案 $host$/idea-docs/Part%20I%20%E6%8F%92%E4%BB%B6/PluginStructure/Components.html
  -->
  <project-components>
    <component>
      <!-- Interface and implementation classes are the same -->
      <implementation-class>com.example.Component2</implementation-class>

      <!--
      If the "workspace" option is set "true", the component saves its state
      to the .iws file instead of the .ipr file. Note that the <option>
      element is used only if the component implements the
      JDOMExternalizable interface. Otherwise, the use of the <option>
      element takes no effect.
      -->
      <option name="workspace" value="true"/>

      <!--
      If the "loadForDefaultProject" tag is present, the project component
      is instantiated also for the default project.
      -->
      <loadForDefaultProject/>
    </component>
  </project-components>

  <!--
  已经弃用,替代方案 https://www.ideaplugin.com/idea-docs/Part%20I%20%E6%8F%92%E4%BB%B6/PluginStructure/Components.html
  -->
  <module-components>
    <component>
      <implementation-class>com.example.Component3</implementation-class>
    </component>
  </module-components>
</idea-plugin>

上次编辑于:
贡献者: zhaojingbo
Loading...