For a custom language plugin, how can my plugin be listed when a user opens a file and the dialog "Plugins supporting files with extension *.foo are found" comes up?
Hi,
I recently created a plugin to support the Robot Framework, and got it published to the Jetbrains repository. Here it is: http://plugins.jetbrains.com/plugin/7430?pr=idea However, some people at my work opened a Robot file when they didn't have the plugin installed, and my plugin wasn't suggested as one of the plugins supporting the file type.
To be specific, the dialog "Plugins supporting files with extension *.robot are found" comes up, and when you click "Install plugins" mine doesn't appear in the list.
You can see my source code on github (https://github.com/jivesoftware/robot-intellij-plugin).
Does anyone know what the requirements are for your plugin to be suggested? I don't see this documented anywhere! I have a fileTypeFactory extension defined, and I'm just now adding an action to create a Robot file from the "New" menu. Everything works fine when you install the plugin, there's an icon, etc.
Here's the relevant bits of my plugin.xml:
<extensions defaultExtensionNs="com.intellij">
<fileTypeFactory implementation="com.jivesoftware.robot.intellij.plugin.lang.RobotFileTypeFactory"/>
<syntaxHighlighter key="soy" implementationClass="com.jivesoftware.robot.intellij.plugin.lang.RobotSyntaxHighlighter"/>
<colorSettingsPage implementation="com.jivesoftware.robot.intellij.plugin.lang.RobotColorsAndFontsPage"/>
<lang.parserDefinition language="RobotTestFile" implementationClass="com.jivesoftware.robot.intellij.plugin.parser.RobotParserDefinition"/>
<psi.referenceContributor implementation="com.jivesoftware.robot.intellij.plugin.elements.references.RobotKeywordReferenceContributor"/>
<gotoSymbolContributor implementation="com.jivesoftware.robot.intellij.plugin.elements.symbols.RobotKeywordDefinitionSymbolContributor"/>
<lang.commenter language="RobotTestFile" implementationClass="com.jivesoftware.robot.intellij.plugin.lang.RobotCommenter"/>
<!-- This enables Find Usages of Robot Keywords defined in Robot -->
<lang.findUsagesProvider language="RobotTestFile"
implementationClass="com.jivesoftware.robot.intellij.plugin.elements.usages.RobotKeywordUsagesProvider"/>
<!-- This enables Find Usages of a Java method that is a Robot Keyword definition -->
<customUsageSearcher implementation="com.jivesoftware.robot.intellij.plugin.elements.usages.RobotCustomUsagesSearcher" />
<!-- This doesn't do much yet, but will provide find usages highlighting, etc. -->
<!-- <findUsagesHandlerFactory implementation="com.jivesoftware.robot.intellij.plugin.elements.usages.RobotFindUsagesHandlerFactory"/>-->
<!-- Enables auto-completion of robot keywords -->
<completion.contributor language="RobotTestFile"
implementationClass="com.jivesoftware.robot.intellij.plugin.elements.completion.RobotCompletionContributor"/>
<internalFileTemplate name="fileTemplates.internal.RobotTestCaseFile"/>
<internalFileTemplate name="fileTemplates.internal.RobotKeywordsFile"/>
</extensions>
<application-components>
<!-- Add your application components here -->
</application-components>
<project-components>
<!-- Add your project components here -->
</project-components>
<actions>
<action id="RobotPlugin.NewFile" text="Robot File"
description="Create a new Robot File">
<add-to-group group-id="NewXml" anchor="last"/>
</action>
</actions>
Thanks in advance for any help!!
请先登录再写评论。
A little digging comes up with:
So, first there are 2 plugins with that extension.
I don't have an answer for you as to why yours doesn't work - try changing the extension so it doesn't conflict with another plugin.
You can see the file type registrations here:
Hi, thanks for your response!
Unfortunately, changing the extension is not an option, as that's the extension for the robot framework http://robotframework.org/. It also supports .txt for test case files, but it is obviously undesirable to use such a common extension.
My plugin isn't listed in the link you provide. Do you have any idea why?
I understand there are other plugins written that support the same extension. However, both of them were suggested and mine was not. I don't see any reason there can't be multiple plugins for ths same language---mine provides Java integration which isn't provided by the existing plugins.
Hope that clarifies the situation!
Thanks,
Charles
As a wild guess - perhaps because it's not easily statically inferrable? :/
My plugin is shown in that list, and both of my FileTypeFactory implementations use constants - whilst your plugin uses a method call...
Maybe try pointing both your FileType's default extension, and the FileTypeFactory's extension to a static constant instead?
This is a complete guess of course :)
I appreciate the observation! I'll do that for the next version of the plugin I release.
That can't be it. My plugin uses a method and it is fine.
https://bitbucket.org/sylvanaar2/lua-for-idea/src/dfc65c42083beec88ba03d1f40ba75300a60b7a8/src/LuaFileTypeLoader.java?at=idea13
https://bitbucket.org/sylvanaar2/lua-for-idea/src/dfc65c42083beec88ba03d1f40ba75300a60b7a8/src/LuaFileType.java?at=idea13
Also, all of my file types show up in the suggestions - so, it is using the filetypefactory implementation. It actually has to execute the code, perhaps that is time consuming, and is done on a delay.
I just looked at your plugin page. Your plugin is in the approval queue. It isn't even available for download yet.
False, it is only waiting to be approved for the newest version. My plugin has been approved for versions 1.01, 1.02, ... 1.05. (And as of writing, it was approved for 1.06). You can download it if you go to "Browse repositories" in
the Settings --> Plugins page.
Also, go here and click "Show all updates": http://plugins.jetbrains.com/plugin/7430?pr=&showAllUpdates=true
There was a bug in the Plugin Repository. The bug is fixed, now IDEA suggests Robot Plugin plugin when user opens *.robot file.
Thanks! Much appreciated you fixed it so fast. I'll try it out now.
It's working, thanks!