JavaScript Support

I have a few questions about depending on the JavaScript plugin in a your own plugin.

First which jars are actually needed? For my case I downloaded Idea Ultimate 14.4 and copied plugins/JavaScriptLanguage/lib/* into a lib folder in my plugin. I got an error saying resources_en.jar had already been included so I removed that.

Second which version of Idea should I be getting these jars from? Do they depend on the rest of Idea? Am I going to have to support multiple versions of my plugin for each version of Idea? The reason I'm asking is I started getting stub parsing errors for a gulp.js file and then a lot of subsequent null pointer expections using the latest Idea 15 EAP. I'm still trying to track down whether it's the EAP version itself or because of my plugin.

Third for my use case at this point I just simply want to register another extension as a JavaScript file. I'm using the optional dependency feature. However, because of this my file type is not registered at all in the community edition. Is there a way to provide the basic syntax highlighting for the community edition?

Any insights into the supporting a JavaScript plugin would be a great help. Thanks!

4 comments
Comment actions Permalink

First of all, if the only thing you need is to associate an extension with the JavaScript file type, you don't need to add a dependency on the JavaScript plugin. You can simply call FileTypeManager.getFileTypeByExtension("js"), check that the returned file type is not UnknownFileType, and then call FileTypeManager.associateExtension() to associate that file type with your extension. This works both with IntelliJ IDEA Ultimate and with the limited keyword-based JavaScript syntax highlighting supported in IntelliJ IDEA Community Edition.

If you do add a dependency on the JavaScript plugin, don't copy its jars anywhere. Instead, you need to add the jar files of the plugin to the classpath of your IntelliJ Platform plugin SDK. Otherwise, IntelliJ IDEA will try to load two copies of the plugin, and all kinds of breakage will occur.

0
Comment actions Permalink

Oh wow, thank you. I was super confused about what I need to do. This make sense. So when I deploy my plugin they are not added to the plugin folder, only for development purposed. Using the FileTypeManager seems like a much better solution to just add the file type. And to extend JavaScript itself I would just rely on the classes from the open-api jar in the JavaScript plugin I would imagine.

0
Comment actions Permalink

Sorry I forgot to ask. Since I'm not going to be using a LanguageTypeFactory anymore, would this just go in a Project or Module component or is there a plugin extension specifically for this purpose?

0
Comment actions Permalink

This would go into an application component.


0

Please sign in to leave a comment.