You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was not aware of this new functionality in IDEA. Looks like it just got introduced by 2023.2, which means it might be a bit tricky to implement without loosing support for older versions of the IDE. (Usually, I would drop support for older versions in about one year.) I am also a bit confused that the Community Edition of IntelliJ is not listed in the blog post. Anyway, if there is a good LSP, it might be an interesting option.
I hoped that there could be some "easy" option to make this backwards compatible, like checking if something is available in the classpath. Also I hoped that there would be some easy way to add ultimate features if there it is the IDE. Maybe I'm just plain wrong with my assumptions :) Would love to see this feature and the future :)
If I can help you in any way just say so :)
FYI, I tried out the LSP integration of IntelliJ on the lsp branch (build). I did not invest much time into that, but it did seem to work with nil. I also tried nixd, but the LSP implementation of IntelliJ throw an exception due to an unexpected token whenever nixd was not able to resolve a reference. Looks like either nixd or IntelliJ has a bug in the protocol implementation.
Anyway, it would be more effort to integrate this without removing support for the previous versions of IntelliJ. It is also a bummer that this feature only works with paid versions of IDEA. Maybe I try out lsp4intellij later, but I fear I will not have time for that in the next few weeks.
I tried out lsp4intellij with nil, but it didn't feel very stable on a first glance. I run into two different NullPointerException and one IllegalArgumentException from within the library within a few minutes of testing.
Clicking on the status icon before you have opend any Nix file.
Clicking on an identifier, for which the Language Server cannot resolve the definition.
Clicking on a variable in a let expression.
I may look a bit closer, but I am currently a bit sceptical.
EDIT: FIY, I also pushed the code to the lsp branch again. See commit ac74690.
Reacted by Steffen Beisenherz and Zacchary Dempsey-Plante
hey @JojOatXGME I think providing LSP support for nix-idea would be huge - the current lack of nixd is the only reason I use VSCode instead of intelliJ for Nix (try it yourself to see the difference!). In every other aspect IntelliJ is better.
I know nothing about LSPs but I have developed an IDEA plugin before and I am happy to help.
For nixd: would it be possible to narrow down what part of the LSP protocol nixd is non-compliant with? Ideally we could get them to fix it or we could just submit a fix with them ourselves
For your backwards compatibility concerns - they are totally fair. I suggest maintaining the 'ahead' version of this plugin (with minimum compatible being 2023.2) and we can package it via Nix to make it very easy for other people to install it manually in IDEA, without having to go through the official marketplace. Potentially we could even provide a patched IDEA (from nixpkgs) that comes with nix-idea installed to make this extra easy - but that's a long shot
@cottand The main reason why I haven't spent more time on implementing LSP-support using the LSP integration is that it would only work in paid versions of IDEA. I only have the community editions, so I wouldn't be able to use it. I fear JetBrains might be reluctant to put this feature into the community editions, as it would make the premium features less worthwhile.
If you would like to spend time on this, I would be open to merge the pull request.
BTW, After my disappointing experiment with lsp4intellij, I also thought about implementing my own LSP integration for a short moment, but then I realized that I don't have time for such a project. 😄
For nixd: would it be possible to narrow down what part of the LSP protocol nixd is non-compliant with?
Not sure, I haven't spent much time on debugging the issue.
For your backwards compatibility concerns
I am not sure if this would still be a problem as IntelliJ 2024.1 might be released in a few months. Anyway, I don't think that this should block us. We could probably drop support for 2023.1 earlier than usual. (The old version of the plugin would still work for previous versions of IDEA.)
we can package it via Nix
Packaging the plugin via Nix is something I would also like to see. However, I think this would be another independent topic. I only spend a limited time thinking about this topic so far. I imagine it might be tricky. Note that the plugin currently uses the official Gradle plugin from JetBrains. This plugin downloads all the dependencies on demand. I am not sure how easy it is to make all of that work in an offline build environment as used by Nix. There are probably some dependencies currently still missing in nixpkgs.
BTW, After my disappointing experiment with lsp4intellij, I also thought about implementing my own LSP integration for a short moment, but then I realized that I don't have time for such a project. 😄
Also completely fair :D
If you would like to spend time on this, I would be open to merge the pull request.
Thanks, I will think about it. I had not realised that the community edition does not support LSPs (yet?). FYI as an open source contributor you could request an Ultimate licence.
We could probably drop support for 2023.1 earlier than usual. (The old version of the plugin would still work for previous versions of IDEA.)
👍 makes sense
As for packaging via Nix, I can make a PR if it is something you want and there are benefits for. I think I can manage Gradle if the dependencies are locked, which is usually the case for JARs.
I had not realised that the community edition does not support LSPs (yet?).
I hope it is yet. However, I can imagine that they fear that it would diminish the value proposition of the ultimate edition. People could easily start using an LSP for JavaScript and other languages, for which you have to pay right now. I haven't found any specific information about that when I looked into it.
As for packaging via Nix, I can make a PR if it is something you want and there are benefits for. I think I can manage Gradle if the dependencies are locked, which is usually the case for JARs.
I personally don't need it right now. So I wouldn't prioritize it that high as long as nobody complains. It just seems strange that this project kind of ignores the packaging process of Nix. Also note that the Gradle plugin org.jetbrains.intellij may download resources directly, bypassing the repository management of Gradle. I think I have seen it in the past. (You can still do it, of course, if you like.)
hey, i think even releasing a basic version like the one you linked above would be a huge boon (built it myself to try out, and the basic functionality it offers is already satisfactory for most of my needs). I really don't wanna have to switch to vscode just for nix files...
@abovestratosphere Do you know if you have tried the version with lsp4intellij, or the version using the LSP integration of IDEA? I was not convinced by lsp4intellij as it did throw a lot of exception during my tests. I am probably not able to fix them. However, if you think it is still valuable, I guess I could think about integrating it behind some feature flag.
Regarding the solution using JetBrains LSP integration (paid versions only): I have recently seen some analytics from JetBrains, and was surprised how many users of the plugin seem to use IntelliJ Ultimate. So, maybe integrating this solution makes more sense as I though initially. I am still only using the community edition, through. 🤷♂️ (Do you have a paid version of IDEA?)
looks like the version i built was e815bfe, all I did was bump the supported IDE version on that commit so it could work for me, so not the lsp4intellij commit. I'm honestly not clear on the difference between using lsp4intellij vs whatever you did in the first commit (not familiar with jetbrains plugin ecosystem at all).
That being said, your first prototype commit is honestly already a huuuuge improvement (being able to just navigate to a nix file by using the "go to source" hotkey on a file path is already a game changer). The only issue is, without it being officially released, I have to constantly bump the version on it and rebuild, like recently everything got updated to 2024.1 so it broke again, which is a hassle.
I personally don't use intellij since I dont work in java but my company sponsors all jetbrains licenses, so yes I have all paid jetbrains IDEs.
FWIW, most folks I know use vscode or neovim for nix (because of lsp support), but I definitely know other diehard jetbrains users who are dying for nix lsp support in this plugin, there's dozens of us :)
Reacted by Johannes Spangenberg, Nico D'Cotta and hab25
I just implemented and released some experimental solution using JetBrains' LSP API. See version 0.4.0.13 and commit cfe2ef1. There are currently no automatic tests, and I only tested the basics manually. I hope everything works.
PS: During my short tests, I no-longer noticed the exception I have observed with nixdin the past. However, nil still provided a better experience during my tests, as it was more responsive. In contrast to nil, nixd also wasn't able to resolve the paths in the files I used.
Reacted by hab25, Ondrej Telka, Rafael Kraut, abovestratosphere, Conrad Dobberstein, Nico D'Cotta, Nikita Volodin, Brawl and Christian Harke
Reacted by hab25, Rafael Kraut, abovestratosphere, Conrad Dobberstein, Nico D'Cotta and Nikita Volodin
@eveeifyeve Feel free to work on it. :) I would be happy to merge such feature. I am happy to help if you need any specific guidance. You can probably start with the developer guide of lsp4ij.
Note that by following the steps described in the document, all users would need to install LSP4IJ as a separate plugin. For the first release, it probably makes sense to make the dependency optional and keep the implementation using JetBrains' API available as well.
FYI, the built-in LSP-API from JetBrains seems to become free to use with future versions of IntelliJ. (EDIT: Although not open source. You have to install the ultimate edition, which will then be free, as long as you don't need the additional functionality.)
FYI, the built-in LSP-API from JetBrains seems to become free to use with future versions of IntelliJ. (EDIT: Although not open source. You have to install the ultimate edition, which will then be free, as long as you don't need the additional functionality.)
Still either way this is an opensource community, I feel like lsp-4ij will make the intellij plugin more open to the public and use editions like the community edition which is opensource.
Activity
JojOatXGME commentedon Sep 4, 2023
Hi, do you have some specific LSPs in mind?
I was not aware of this new functionality in IDEA. Looks like it just got introduced by 2023.2, which means it might be a bit tricky to implement without loosing support for older versions of the IDE. (Usually, I would drop support for older versions in about one year.) I am also a bit confused that the Community Edition of IntelliJ is not listed in the blog post. Anyway, if there is a good LSP, it might be an interesting option.
beisenherz commentedon Sep 4, 2023
There are two LSPs I know of that are somewhat Feature complete. Nil (https://github.com/oxalica/nil) and Nixd (https://github.com/nix-community/nixd).
I hoped that there could be some "easy" option to make this backwards compatible, like checking if something is available in the classpath. Also I hoped that there would be some easy way to add ultimate features if there it is the IDE. Maybe I'm just plain wrong with my assumptions :) Would love to see this feature and the future :)
If I can help you in any way just say so :)
JojOatXGME commentedon Sep 10, 2023
FYI, I tried out the LSP integration of IntelliJ on the
lspbranch (build). I did not invest much time into that, but it did seem to work with nil. I also tried nixd, but the LSP implementation of IntelliJ throw an exception due to an unexpected token whenever nixd was not able to resolve a reference. Looks like either nixd or IntelliJ has a bug in the protocol implementation.Anyway, it would be more effort to integrate this without removing support for the previous versions of IntelliJ. It is also a bummer that this feature only works with paid versions of IDEA. Maybe I try out lsp4intellij later, but I fear I will not have time for that in the next few weeks.
JojOatXGME commentedon Sep 24, 2023
I tried out lsp4intellij with nil, but it didn't feel very stable on a first glance. I run into two different
NullPointerExceptionand oneIllegalArgumentExceptionfrom within the library within a few minutes of testing.I may look a bit closer, but I am currently a bit sceptical.
EDIT: FIY, I also pushed the code to the
lspbranch again. See commit ac74690.cottand commentedon Jan 16, 2024
hey @JojOatXGME I think providing LSP support for nix-idea would be huge - the current lack of nixd is the only reason I use VSCode instead of intelliJ for Nix (try it yourself to see the difference!). In every other aspect IntelliJ is better.
I know nothing about LSPs but I have developed an IDEA plugin before and I am happy to help.
What do you think?
JojOatXGME commentedon Jan 16, 2024
@cottand The main reason why I haven't spent more time on implementing LSP-support using the LSP integration is that it would only work in paid versions of IDEA. I only have the community editions, so I wouldn't be able to use it. I fear JetBrains might be reluctant to put this feature into the community editions, as it would make the premium features less worthwhile.
If you would like to spend time on this, I would be open to merge the pull request.
BTW, After my disappointing experiment with lsp4intellij, I also thought about implementing my own LSP integration for a short moment, but then I realized that I don't have time for such a project. 😄
Not sure, I haven't spent much time on debugging the issue.
I am not sure if this would still be a problem as IntelliJ 2024.1 might be released in a few months. Anyway, I don't think that this should block us. We could probably drop support for 2023.1 earlier than usual. (The old version of the plugin would still work for previous versions of IDEA.)
Packaging the plugin via Nix is something I would also like to see. However, I think this would be another independent topic. I only spend a limited time thinking about this topic so far. I imagine it might be tricky. Note that the plugin currently uses the official Gradle plugin from JetBrains. This plugin downloads all the dependencies on demand. I am not sure how easy it is to make all of that work in an offline build environment as used by Nix. There are probably some dependencies currently still missing in
nixpkgs.cottand commentedon Jan 19, 2024
Also completely fair :D
Thanks, I will think about it. I had not realised that the community edition does not support LSPs (yet?). FYI as an open source contributor you could request an Ultimate licence.
👍 makes sense
As for packaging via Nix, I can make a PR if it is something you want and there are benefits for. I think I can manage Gradle if the dependencies are locked, which is usually the case for JARs.
JojOatXGME commentedon Jan 20, 2024
I hope it is yet. However, I can imagine that they fear that it would diminish the value proposition of the ultimate edition. People could easily start using an LSP for JavaScript and other languages, for which you have to pay right now. I haven't found any specific information about that when I looked into it.
I personally don't need it right now. So I wouldn't prioritize it that high as long as nobody complains. It just seems strange that this project kind of ignores the packaging process of Nix. Also note that the Gradle plugin
org.jetbrains.intellijmay download resources directly, bypassing the repository management of Gradle. I think I have seen it in the past. (You can still do it, of course, if you like.)cottand commentedon Jan 21, 2024
done :)
sounds good, I will consider spending time on this, and we can revisit if JetBrains makes lsp available for the community edition
abovestratosphere commentedon Apr 9, 2024
hey, i think even releasing a basic version like the one you linked above would be a huge boon (built it myself to try out, and the basic functionality it offers is already satisfactory for most of my needs). I really don't wanna have to switch to vscode just for nix files...
JojOatXGME commentedon Apr 9, 2024
@abovestratosphere Do you know if you have tried the version with lsp4intellij, or the version using the LSP integration of IDEA? I was not convinced by lsp4intellij as it did throw a lot of exception during my tests. I am probably not able to fix them. However, if you think it is still valuable, I guess I could think about integrating it behind some feature flag.
Regarding the solution using JetBrains LSP integration (paid versions only): I have recently seen some analytics from JetBrains, and was surprised how many users of the plugin seem to use IntelliJ Ultimate. So, maybe integrating this solution makes more sense as I though initially. I am still only using the community edition, through. 🤷♂️ (Do you have a paid version of IDEA?)
abovestratosphere commentedon Apr 10, 2024
looks like the version i built was e815bfe, all I did was bump the supported IDE version on that commit so it could work for me, so not the lsp4intellij commit. I'm honestly not clear on the difference between using lsp4intellij vs whatever you did in the first commit (not familiar with jetbrains plugin ecosystem at all).
That being said, your first prototype commit is honestly already a huuuuge improvement (being able to just navigate to a nix file by using the "go to source" hotkey on a file path is already a game changer). The only issue is, without it being officially released, I have to constantly bump the version on it and rebuild, like recently everything got updated to 2024.1 so it broke again, which is a hassle.
I personally don't use intellij since I dont work in java but my company sponsors all jetbrains licenses, so yes I have all paid jetbrains IDEs.
FWIW, most folks I know use vscode or neovim for nix (because of lsp support), but I definitely know other diehard jetbrains users who are dying for nix lsp support in this plugin, there's dozens of us :)
Add LSP support (#68) [paid versions of IDEA only]
Add LSP support (#68) [paid versions of IDEA only]
hab25 commentedon Apr 17, 2024
@abovestratosphere did you use
nixdornil? Ifnixd, did you run into the issues described by @JojOatXGME, which are seemingly protocol-related?abovestratosphere commentedon Apr 17, 2024
I used whatever that commit e815bfe used, which is nil
andrew222651 commentedon Apr 24, 2024
I haven't tried it but there's https://github.com/redhat-developer/lsp4ij
Add LSP support [paid versions of IDEA only] (#68)
Add LSP support [paid versions of IDEA only] (#68)
Add LSP support [paid versions of IDEA only] (#68)
JojOatXGME commentedon Apr 29, 2024
I just implemented and released some experimental solution using JetBrains' LSP API. See version 0.4.0.13 and commit cfe2ef1. There are currently no automatic tests, and I only tested the basics manually. I hope everything works.
As it is using JetBrains' API, it only works for paid versions of IDEA. If someone wants to try out https://github.com/redhat-developer/lsp4ij (thanks @amacfie) to make it available for free, I am happy to help. I may also take a look at it at some point, but probably not in the near future.
PS: During my short tests, I no-longer noticed the exception I have observed with nixd in the past. However, nil still provided a better experience during my tests, as it was more responsive. In contrast to nil, nixd also wasn't able to resolve the paths in the files I used.
abovestratosphere commentedon May 1, 2024
@JojOatXGME thanks a lot. just tested, it works great for me.
angelozerr commentedon May 28, 2024
LSP4IJ 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
eveeifyeve commentedon May 19, 2025
I would be happy to add lsp support via https://github.com/redhat-developer/lsp4ij instead of intellij api since it locks the apis behind paywalls in intellij idea community edition.
JojOatXGME commentedon May 21, 2025
@eveeifyeve Feel free to work on it. :) I would be happy to merge such feature. I am happy to help if you need any specific guidance. You can probably start with the developer guide of lsp4ij.
Note that by following the steps described in the document, all users would need to install LSP4IJ as a separate plugin. For the first release, it probably makes sense to make the dependency optional and keep the implementation using JetBrains' API available as well.
angelozerr commentedon Jun 26, 2025
@eveeifyeve do you need some help to integrate LSP support with LSP4IJ?
Please note that LSP4IJ provides also a DAP support, it seems you could use lldb (see https://github.com/redhat-developer/lsp4ij/blob/main/docs/dap/user-defined-dap/swift-lldb.md or codelldb (I need to write doc for that)
JojOatXGME commentedon Jul 19, 2025
FYI, the built-in LSP-API from JetBrains seems to become free to use with future versions of IntelliJ. (EDIT: Although not open source. You have to install the ultimate edition, which will then be free, as long as you don't need the additional functionality.)
https://platform.jetbrains.com/t/lsp-api-available-in-intellij-idea-ultimate-2025-2-without-paid-subscription/2284
eveeifyeve commentedon Jul 19, 2025
Still either way this is an opensource community, I feel like lsp-4ij will make the intellij plugin more open to the public and use editions like the community edition which is opensource.
Enable `nixd` when in dev shells