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

Request: option to "Restart extensions" automatically on startup #519

Open
tennox opened this issue Jun 8, 2023 · 2 comments
Open

Request: option to "Restart extensions" automatically on startup #519

tennox opened this issue Jun 8, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@tennox
Copy link

tennox commented Jun 8, 2023

Thanks for this great extension ❤️

I like that it doesn't auto-restart when I change the direnv during development, but on startup it's often just a bit annoying I have to click it each time I open a new window.

I know that it's not possible to skip this step of reloading extensions, so I thought it could auto-restart when opening the window?

@mkhl mkhl added the enhancement New feature or request label Jun 9, 2023
@mkhl
Copy link
Contributor

mkhl commented Jun 9, 2023

This is an interesting idea, thanks!

I don't think vscode has API to determine whether we are (still) starting up (also see below) so we'd have to modify the load during activation. The experiment/sync branch might have some inspiration in case you want to give it a go.

Some caveats that come to mind:

  • It's Hard to really determine whether we're still in startup, because the direnv execution can take arbitrarily long. Like when it starts downloading and/or building a whole toolchain or dependencies to work on stuff. And when the first run on activation does take long, and one starts working while it runs, then getting interrupted would suck 😔
  • In case stuff goes wrong and the extension keeps believing it has to restart then this would throw it into an infinite automatic restart loop, we might want some protection against that 🤔

…That said, the same arguments apply to the existing auto restart preference, so if we default to false that should be fine*? And I can start thinking about some auto restart loop detection.

@tennox
Copy link
Author

tennox commented Jun 9, 2023

This is an interesting idea, thanks!

No, thank you 😋

I don't think vscode has API to determine whether we are (still) starting up (also see below) so we'd have to modify the load during activation. The experiment/sync branch might have some inspiration in case you want to give it a go.

I will check it out 🤘

  • It's Hard to really determine whether we're still in startup, because the direnv execution can take arbitrarily long.

Wouldn't we be able to save the timestamp when direnv execution starts and have an arbitrary (configurable) max time for the auto-reload?

  • In case stuff goes wrong and the extension keeps believing it has to restart then this would throw it into an infinite automatic restart loop, we might want some protection against that 🤔

That is a good idea 😅
Is there a persistent storage for vscode extensions? Or use .direnv/vscode-ext-data.json (as that should be in gitignore)?
There you could save the last auto-restart attempt (and if it was successfull), and if there was a recent one (&& it did not succeed) - then skip auto-reload... or something like that 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants