Custom Language Plugin Advice

I am looking at developing a custom Language Plugin and have a few questions:

1. If developed in IntelliJ - will it work with PHPStorm?

2.  The syntax of the language I am targeting is horrible, is there an  opensource language plugin that would get me started as I am a noob java  programmer. The language I am targeting is a old language called  i-HTML. The syntax is very similar to HTML/XML as exampled below:

<iSET test=3>
<iLOOP Alias="a" STEP="1" Initial="1" Final="4">
     <iIF EXPR=":a = 3" Alias="crazy1">
          <iCASE Alias="test" Value="3">
               <b>:a</b> -  (:test)<br />
               <iREM --- this is a comment --->
               <iREMBLOCK>
               yup this is a comment block
               </iREMBLOCK>
           </iCASE Alias="test">
     <iELSE Alias="crazy1">
          Not equal to 3<br />
     </iIF Alias="crazy1">
</iLOOP Alias="a">

The  reason we want to create the plugin is that we have been using PHPStorm  for all of our new development, but we have all of these old projects  which use i-HTML. It would be nice to make use of the power of the IDE  on the older stuff as well.

If you are curious, you  can see more at www.ihtml.com. Just to clarify, I am no longer a fan of  iHTML, but have no choice for the next few years of having to put up  with it.

3. Is there anyone out there that would like to offer to write the plugin for me LOL, for a price of course?

Many Thanks!

P.

4 comments
Comment actions Permalink

What features would you like?

Assuming

  1. iHTML is valid xml
  2. you have a pretty comprehensive set of iHTML files already


code completion and error highlighting would be very simple to do without a custom language.

http://stackoverflow.com/questions/74879/any-tools-to-generate-an-xsd-schema-from-an-xml-instance-document

I believe I used Trang for my situation. Run all of your iHTML files through a program that supports making an xsd from multiple instance xml files.

Then, tell IntelliJ about the schema:

https://blog.jetbrains.com/idea/2012/07/easy-xml-schema-configuration-in-intellij-idea-12-leda/

Feel free to pay me, too. :)

1
Comment actions Permalink

I have an extensive knowledge of iHTML and have been writing it since the 90's. Currently I am using jEdit as my iHTML editor and have created a cusom language file, however IntelliJ offers so much more if a language is setup correctly in the IDE. I would not say that it is valid XML, but it is similar in its design. iHTML has parameters in closing tags as well, which I dont think XML allows for. The language plugin would also have to account for mismatched closing tags with incorrect aliases etc.

We are actually porting many of our iHTML projects over to PHP as iHTML is a language that is not well maintained.

I will review the links that you provided and see if that offers a solution.

Thanks

P.

0
Comment actions Permalink

Hi,

1. If you develop against the openapi, i.e. the community edition of IntelliJ, then your plugin will work with the other products of the same build range. For example: If you develop a plugin for IntelliJ community edition builds 143.x then it will work in PhpStorm, Webstorm, PyCharm etc which are based on the 143.x builds.

2. If you develop from scratch you need the basics at first, i.e. lexer, parser, PSI. Then highlighting, editor inspections, refactorings, etc.
Documentation is available at http://www.jetbrains.org/intellij/sdk/docs/ and http://www.jetbrains.org/intellij/sdk/docs/faq.html , for example.
The IntelliJ XML implementation is at https://github.com/JetBrains/intellij-community/tree/210e0ed138627926e10094bb9c76026319cec178/xml , but this is probably overly complex as it supports much more than a simple plugin needs at first.
My own plugin is available at https://github.com/jansorg/BashSupport . If you learn about the basics (mentioned above) then it will be much easier to understand other plugins.

3. You could make an offer ;)

Best regards,
Wallaby

0
Comment actions Permalink

I agree with Wallaby and would add:

1. For the deveopment environment I used IntelliJ IDEA CE when I first started with my plugin, idea-multimarkdown, http://vladsch.com/product/multimarkdown. It worked well but recommend going with IDEA Ultimate for greater development comfort. It is really a pleasure to work with, once you figure out how it is intended to be used.

You can build the plugin with a newest version of IDEA or IDEA CE and have it work with older versions of IDEA and PhpStorm. You only have to be careful not to use any OpenAPI classes and methods that are not available on older versions and keep JVM compatibility level to whatever minimum you want to support with your plugin. My plugin worked with IDEA 13.1, until I added some features that need IDEA 14.0. However, at all times it was built with the latest EAP version that was available.

For PhpStorm you have to stick to parts of the OpenAPI that is available in PhpStorm. Some Java related classes are not in PhpStorm distribution. Since you are building a PhpStorm plugin, I would recommend using it as your plugin-SDK, that way anything it does not have will be a highlighted in the IDEA and will be a compile time error.

2. at first you may want to narrow down you exposure to: https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/simple_language_plugin, especially if you are not a seasoned Java develper and familliar with setting up an IDEA Java project.

The simple plugin is a sample of a very simple custom language plugin that has most of the elements a custom plugin will need. Getting the environment setup for building that plugin will be a good base to be re-used for your actual plugin. Simple plugin has a Lexer, Parser, Annotator, etc and all the corresponding entries in the plugin.xml file. The latter is no small feat. You can have everything done right but not have the right entries in the plugin.xml file and nothing will happen that you expect.

I would just copy the SimplePlugin source and use it as a starting point for your plugin. Just use rename refactoring to rename classes so that all related files are properly updated. Keep the changes you make initially to a minimum until you learn the lay of the land. Test after every small change to make sure you did not break anything and if you did at least you will know what change caused it.

Intellij plugins are an extension of a very complex environment, that has certain rules and assumptions about how things are done. Step off the beaten path and you may find yourself in uncharted territory, with weird symptoms and bugs no one encountered because no one did it that way before you or imagined someone would. On the other hand if you know how things are done: what, where, when and how; complex functionality may be just a few judicious lines of code.

Once you have the basics asimilated you will want to look at: https://github.com/JetBrains/intellij-plugins, it is a wealth of information about how plugin features are implemented. I find it is faster to find information I need in there than anywhere else.

3. If your company is serious about doing this project then contact me and we will discuss your needs, budget and timeframe. I can help you get started, which is the hardest part of the job with a custom language plugin. In the long run, I can make myself available to give you support when you need it. However, to maintain it for a few years, it is better for you to have expertise in-hose. Having it built completely by an outsider is not the best option.

Good luck.

0

Please sign in to leave a comment.