EnvFile icon indicating copy to clipboard operation
EnvFile copied to clipboard

Add .envrc(direnv) support

Open shinichy opened this issue 4 years ago • 3 comments

Fixes #102

  • Add DirenvProvider to support .envrc file
  • Add org.jetbrains.intellij plugin to core because it depends on several classes in com.intellij.execution. Please let me know if there's any other better way to resolve the classes
  • Add getFileFilter and showHiddenFiles methods to EnvVarsProviderFactory interface to allow selecting only .envrc file.

shinichy avatar Oct 25 '21 06:10 shinichy

@ashald Would you take a look?

shinichy avatar Nov 18 '21 16:11 shinichy

Incidentally, you don't need to add direnv to /usr/local/bin or any other "pointy" location. Creating a .zprofile (for zsh for example) with proper PATH setup will enable IntelliJ (or any other IDE or Spotlight/Dock launched app from macOS) to obtain a much more usable set of environment variables.

See: MacOS - ZSH: .zprofile, .zshrc, .zlogin...

cmmoran avatar Feb 24 '22 13:02 cmmoran

@ashald Do you have a chance to review this PR?

shinichy avatar Apr 26 '22 22:04 shinichy

I'd be glad to merge .envrc support, thought this PR breaks abstraction where core module is agnostic of intelij. I might get some time to look into fixing it in November, but if you could update it accordingly it'd help get it merged sooner.

ashald avatar Oct 02 '22 07:10 ashald

@ashald Thank you for reviewing this PR. I updated this PR not to break the core module abstraction. Would you take a look again?

shinichy avatar Oct 03 '22 04:10 shinichy

@shinichy ugh, my apologies, I just worked on refactoring some mess in core module to make the interface cleaner. I just submitted a release, and unless there is a critical bug, I don't plan to make any changes to the code. Could you please rebase your changes one more? Apologies for back and forth.

ashald avatar Oct 03 '22 07:10 ashald

@ashald No worries. I fixed all the conflicts. Could you please take a look again?

shinichy avatar Oct 03 '22 14:10 shinichy

Hi @shinichy, apologies for a delayed reply. I was thinking about it for a long time and eventually I realized I would rather not merge in providers that depend on external tools.

What I can offer to you instead is the extension point interface such that you could pack your changes as an independent plugin that relies on extension points provided by EnvFile, but can be installed separately. Please let me know if anything is missing in the current interface that would be necessary for you to implement the above.

P.S.: Alternatively, the latest version of EnvFile can execute any given file and interpret stdout as .env or JSON/YAML. To the best of my understanding, you could wrap a call to direnv in a tiny script that would just output env vars you set.

ashald avatar Nov 22 '22 04:11 ashald

@ashald Thanks for letting me know. I don't use IntelliJ and direnv these days, so I'll check your suggestions when I have a chance to use IntelliJ again.

shinichy avatar Nov 22 '22 04:11 shinichy