Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The following extensions want to relaunch the terminal to contribute to its environment: direnv" #639

Open
Nezteb opened this issue Oct 19, 2023 · 5 comments

Comments

@Nezteb
Copy link

Nezteb commented Oct 19, 2023

I frequently get prompted by VS Code to reload the direnv extension with a message like so:

screenshot_2023-10-19_at_19 08 29@2x

OS: macOS 13.6 (M2)
Editor: VS Code 1.84.0-insider
Extension: v0.15.2
Shell env: Nushell 0.85.0

My Nushell config:

# ~/.config/nushell/config.nu

# ...
$env.config = {
    # ...
    hooks: {
        # ...
        env_change: {
            # https://direnv.net/docs/hook.html#nushell
            PWD: { ||
                if (which direnv | is-empty) {
                    return
                }
            
                direnv export json | from json | default {} | load-env
            }
        }
        # ...
    }
    # ...
}
# ...
@mkhl
Copy link
Contributor

mkhl commented Oct 20, 2023

I'm not sure where the issue is, could you explain what you're expecting and how what you're seeing is different?

@Nezteb
Copy link
Author

Nezteb commented Oct 20, 2023

I guess I'd just like to avoid this popup, which currently shows up on every newly opened VS Code window/shell:

screenshot_2023-10-20_at_17 24 24@2x

Personally I'd rather the extension just do the restart for me. Or perhaps that choice could be a config option?

@mkhl
Copy link
Contributor

mkhl commented Oct 20, 2023

Personally I'd rather the extension just do the restart for me. Or perhaps that choice could be a config option?

It is, you can enable direnv.restartAutomatic

@Nezteb
Copy link
Author

Nezteb commented Oct 20, 2023

I am an idiot and didn't know that was a thing.

Perhaps this leads to a feature request: that pop up could have buttons for "Restart This Time" and "Always Restart (can be changed in settings)" which will toggle that setting or something. What do you think? 😄

@mkhl
Copy link
Contributor

mkhl commented Oct 23, 2023

I think that's a great idea :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants