Project-specific environment variables

Answered

Hi, I would like to implement a `nix-shell` integration for the IntelliJ Platform (i.e. see issue #1 of nix-idea plugin). Nix-shell is a tool to launch a shell with a specific environment based on some configuration. It is kind of similar to virtualenv, but not specific to Python.

My problem is that IntelliJ doesn't seem to have universal extension points for modifying the environment when launching processes within a project. For example, the following extension points all seemingly have the same objective, but are specific to their own IDE:

  • com.intellij.​run​Configuration​Extension (Java)
  • Pythonid.​run​Configuration​Extension (Python)
  • cidr.​run​Configuration​Extension (C/C++)
  • com.​goide.​run​Configuration​Extension (Go)
  • org.​jetbrains.​plugins.​ruby.​run​Configuration​Extension (Ruby)
  • org.​rust.​run​Configuration​Extension (Rust)

Note that some IDEs are missing. I don't know if there are similar extension points for them. Besides that, I also found the following extension points which I probably also have to implement:

  • com.​intellij.​external​System.​run​Configuration​Ex
  • com.intellij.pathMacroContributor
  • org.jetbrains.plugins.terminal.localTerminalCustomizer
  • org.jetbrains.plugins.gradle.executionEnvironmentProvider
  • Pythonid.pythonCommandLineEnvironmentProvider

There might be many more extension points I have missed. In addition to that, I should probably also implement new SDK detectors if I want the SDK from the environments to be detected. This is a lot of effort, especially because I would have to introduce an optional dependency to every IDE available. It is also rather error-prone because I might easily miss some extension points for specific IDEs. It might also be possible that some cases in some IDEs don't even have extension points for changing the environment.

So here are my questions. Did I miss something which would make the implementation easier? If not, is it possible to add extension points which simplify this process? If I don't find another solution, I might be willing to contribute to the open source platform, but I am not sure about the process.

2 comments
Comment actions Permalink

Hi Johannes,

Unfortunately, as you noticed there is no common extension point for your use case.

Please create an issue in https://youtrack.jetbrains.com/issues/IDEA with your use case and extension points ideas. You can also express your willingness to implement them if they are accepted. Thank you.

0

Please sign in to leave a comment.