fehnomenal / intellij-direnv

direnv integration for JetBrains IDEs
MIT License
66 stars 21 forks source link

Displays the current direnv state in settings #26

Open Fapiko opened 2 years ago

Fapiko commented 2 years ago

Useful for debugging what the current state of the direnv environment variables are. Shows the current state in settings dialog. Builds on https://github.com/fehnomenal/intellij-direnv/pull/25 but wanted to keep them separate for simpler PR reviewing.

Updated this PR with better GoLand support. It wouldn't update the env vars after the initial import, this injects them directly into the run config.

Fapiko commented 2 years ago

I noticed that the way I was getting the env vars here was leaking across projects - it seems it's importing the direnv stuff at the process level instead of during the run config execution. I started bootstrapping my own plugin just to get some familiarity with the IntelliJ plugin system - https://github.com/Fapiko/intellij-better-direnv - feel free to rip anything out of that to bring in here.

The tricky part is the build system - to create a run configuration extension for each IDE type, the only way I found that folks were doing it (EnvFile & ProjectEnv) was to create a Gradle module per IDE to split up the dependencies. The plugin.xml optionally includes sub-xml files depending on whether or not the specified dependency is available, so it should work for all without requiring them to install all the plugins.

From what I could see, if it's not implemented via the run configuration then it's at the process level which means if you have 4 projects open in GoLand, it's going to share the direnv state between them.

pboling commented 1 month ago

I'm glad I saw this. I've been trying to get one of these two plugins to work, and currently they are both broken. :(. Additionally it seems that the ease of use of @fehnomenal's plugin is hampered by shared state, but the complexity of setup of the @Fapiko's plugin per project is prohibitive (I contribute to hundreds of projects).

So they are both currently broken, and even if they were working, both solutions have huge downsides. Perhaps we can figure out a better way forward?