fehnomenal / intellij-direnv

direnv integration for JetBrains IDEs
MIT License
60 stars 18 forks source link

Does not work on GoLand #11

Open fehnomenal opened 3 years ago

fehnomenal commented 3 years ago

https://plugins.jetbrains.com/plugin/15285-direnv-integration/reviews#review=51879

fiksn commented 3 years ago

I have the same issue with GoLand (and also IntelliJ IDEA).

Looked at the code:

        val process = executeDirenv(envrcFile, "export", "json")

        if (process.waitFor() != 0) {
            handleDirenvError(process, envrcFile)
            return
        }

        val notification = jsonFactory.createParser(process.inputStream).use { parser ->

it seems the plugin wants to parse the output of direnv export json. And apparently that used to work some while ago - https://github.com/direnv/direnv/issues/467 . However if I try to manually run that command in the workdir containing .envrc the command succeeds but I get no output whatsoever (direnv allow . or not does not matter). So on first sight it appears that all the issues with intellij-direnv not doing anything come from the fact that direnv api has changed (or is not working as expected)? Does anyone know something about this? The command is still available tho https://github.com/direnv/direnv/blob/master/cmd_export.go

fiksn commented 3 years ago

Low hanging fruit theory - that direnv somehow changed the API which broke the integration can be dismissed I guess (see related issue).

My next theory / question is regarding https://github.com/fehnomenal/intellij-direnv/blob/master/src/main/kotlin/systems/fehn/intellijdirenv/services/EnvironmentService.kt. Ok, I can see how you change response of System.getenv() with some reflection. But I wonder how does that even work? I mean some other part could directly call functions to get environment variables and be totally unaffected by this or am I mistaken?

phorsuedzie commented 2 years ago

Workaround for a single project (i.e. without this plugin): start GoLand from the terminal, which then has all environment from direnv already loaded:

For macos, this is

open -a goland