langium
langium copied to clipboard
Intellij template
This PR adds the option to generate a plugin for IntelliJ-based IDEs (including WebStorm, Android Studio, and many others listed here). It is largely based on JetBrains/intellij-platform-plugin-template. It depends on the LSP4IJ community plugin by RedHat to add LSP support to non-paid versions of the IDEs.
While LSP4IJ currently supports IntelliJ starting with version 2023.2, the plugin generated by this template requires at least 2024.1 for TextMate highlighting support. Ideally, we should instead generate IntelliJ's own syntax highlighting factory, but I don't think I will have the time to do that anytime soon since TextMate fits my needs (I already had a comprehensive TextMate grammar defined long ago and wanted to reuse it).
I should also note that I am totally not an expert in Java/Kotlin, so the code there may not be the best Kotlin code, but it does the job and I was guided by IntelliJ IDEA 😁.
Hi @msujew, I understand your point, especially about the maintenance, but after spending several days trying to get everything right for an IntelliJ plugin, I thought it would be helpful to others if I add it to the template, especially that the documentation about it is not so great and I had to search through multiple forums and deal with some bugs that had no logs and so on, so I just wanted to share it to save other people's time (especially those not proficient in Java/Kotlin, like me).
About the Langium-specific part being minimal, isn't that also the case with the web package, for example?
We could technically make it into a guide, but it will mostly consist of "add this file with that content" blocks, so I don't see why maintaining the guide would be any less effort than maintaining the template (which should hopefully not require that much maintenance anyway).
@aabounegm and @msujew maybe after #1520 is merged, we could think about making the generator extendable. If the npm package exposes callable functions/extendable methods to process an additional package, then any further code extending the generator must not be contained here. Then even for the web package could be moved to an external location. Let me think about that, but only after #1520 is merged (it is already too big).
Yes, I definitely agree that this one should only be considered after the main one is merged, I just wanted to get it out of the way before I forget the context of how I made the plugin 😁. Perhaps it would be better if I convert it to a draft PR for now.
Hey @aabounegm, thanks for looking into this. We've had discussions around this in the past (see https://github.com/eclipse-langium/langium/issues/999 and https://github.com/eclipse-langium/langium-website/issues/243) and I believe this is better served as a guide on our website rather than included in the yeoman generator. I'm kind of torn on this issue right now. While this increases our reach beyond the VS Code ecosystem in an easy-to-use way, it's also quite a bit of maintenance effort and we don't have anyone (in the active Langium committers) working on IntelliJ based plugins right now at all. Since the langium-specific part of this is rather minimal (most of this PR is IntelliJ boilerplate), I would rather expect a yeoman generator or similar from the RedHat people for this, instead of us offering something. As mentioned, I'd rather see this as a page on our website, mostly just linking to the developer guide for LSP4IJ with some langium-specific additions on top. @spoenemann @kaisalmen your thoughts on this?
I agree. The increased maintenance effort would become a problem with time.
What's the normal way to create projects in IntelliJ? Eclipse has a concept of "Project Wizards" that do the same as Yeoman, but with a GUI.
I agree. The increased maintenance effort would become a problem with time.
Alright, if you prefer, I can simply make a template repo on my personal account so it doesn't become a maintenance burden on you, because I believe a template would be much more useful than a guide. Perhaps a dedicated README covering what the template does (and how it changed from the original IntelliJ plugin template) could serve as a guide for how to keep it up to date as well.
What's the normal way to create projects in IntelliJ?
I'm not sure, to be frank. I'm not an IntelliJ user myself, but some of the users of the language I'm working on are. This particular project was based on JetBrains/intellij-platform-plugin-template.
I finally made a template repo with the contents of this PR so I can finally close it: aabounegm/langium-intellij-template
@aabounegm that repo is archived, is that on purpose?
@spoenemann yeah, it seemed to me that the base PR (#1520) kinda stalled, and I don't think I intend to maintain the IntelliJ any further, so I archived to avoid annoying dependabot alerts. If there is a good enough reason (at least some demand), I can unarchive.