Closed ctron closed 2 months ago
Hi @ctron,
Langium can be used by every editor that somehow supports the language server protocol (LSP). There's an LSP plugin available for IntelliJ that would allow to connect to a Langium based language server.
Note that for IntelliJ in particular, the LSP is effectively a second-class citizen, since their "normal" languages are so tightly integrated into the IDE, which is just not feasible with the LSP alone. This is why we don't offer explicit support for IntelliJ as of now. In theory you could provide a more deeply integrated, specialized plugin for a Langium based language, but I'm not sure how one would go on about this. My knowledge about IntelliJ plugin development is fairly limited.
Also note that JetBrains have their own DSL workbench specificially crafted towards their products called MPS. Maybe that fits better with your requirements.
On the homepage it is mentioned that Langium can be used for IntelliJ editors. However, I wasn't able to find any information on how this could be achieved.
I think it makes sense to provide an example project, or at least outline the steps necessary.
I have tried both the IntelliJ Marketplace Plugin https://plugins.jetbrains.com/plugin/10209-lsp-support and the IntelliJ Plugin dependency https://github.com/ballerina-platform/lsp4intellij.
The Marketplace Plugin is actually working: Validations, Quick Fixes, Formatting, etc. But it crashes randomly and is not actively developed anymore.
With the lsp4intellij solution you need to setup you own IntelliJ extension project and integrate the Langium LSP server into it. It did not work for me, even though the project seems to be still alive. It does connect to the Langium LSP Server and I can even see that it receives notfications from it (e.g. on Hover) but it does not display it in the IntelliJ UI.
For me the IntelliJ LSP integration looks not really stable at the moment. Also note that Syntax Highlighting usually does not work via LSP. Meaning you need to add Syntax Highlighting manually for IntelliJ / Eclipse / Other LSP editor.
Instead of IDEA, Jetbrains is coming out with Fleet soon which uses LSP, so support should be much easier for that product once it supports editor plugins.
Please try https://github.com/redhat-developer/lsp4ij which is a free lsp support for intellij
Fellows at zenstack were able to create the JetBrains extension:
In the meantime, JetBrains has started offering LSP support for their paid IDEs: https://blog.jetbrains.com/platform/2023/07/lsp-for-plugin-developers/
As I understand this, the solution is not available for the open source IntelliJ Platform.
@spoenemann as I said please try https://github.com/redhat-developer/lsp4ij which is a free lsp support for intellij which has been released.
If you want to try to integrate your language server without developping an IJ plugin please read https://github.com/redhat-developer/lsp4ij/blob/main/docs%2FUserDefinedLanguageServer.md
If you want to try to integrate your language server by developping an IJ plugin please read https://github.com/redhat-developer/lsp4ij/blob/main/docs%2FDeveloperGuide.md
If you want to know the LSP support please read https://github.com/redhat-developer/lsp4ij/blob/main/docs%2FLSPSupport.md
@spoenemann just for your information, we did the 0.0.2 release of LSP4IJ and if you want to have an overview of LSP4IJ, please read Meet LSP4IJ, a new LSP Client for JetBrains-based IDEs article that we have published on friday.
Hope you will like it.
Nice!
I've opened https://github.com/eclipse-langium/langium-website/issues/243 to track documentation on this. I think we should continue the discussion there. I'm closing this issue.
Thanks for the info about LSP4IJ, we'll surely include this on the website.
On the homepage it is mentioned that Langium can be used for IntelliJ editors. However, I wasn't able to find any information on how this could be achieved.
I think it makes sense to provide an example project, or at least outline the steps necessary.