-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Do not wait for shell environment resolution before opening window #108804
Comments
After discussion with @joaomoreno we think this could work:
Depending the platform, the implementation will talk to the
Adoption needs to take place anywhere we want this merged flat view of the environment, e.g. when we spawn the extension host but also in other places. The challenge is that the environment will be a |
If the first launch of VS Code started from CLI, under let's say some Python virtualenv, then any new window created not from CLI will have that virtualenv applied. That's unlike the case when the first launch of VS Code was from UI, where it would just have the shell environment. What I'm trying to say is that anything that depends on whatever the first launch happened to be is confusing. It might make more sense for it to only depend on the way the current launch happened, independent of whatever the first launch happened to be. But that's just my two cents, there may be a reason for it that I'm not seeing. Or maybe that first launch thing is really for when you launch a new VS Code window from another VS Code window, rather then the OS GUI. Maybe it would make more sense to inherit the environment of that window then, instead of the environment of the first launch. Any work on improving the environment variables situation is more than welcome anyhow. |
@segevfiner that could be seen as breaking behaviour though, no? I wonder if we could have a setting that enforces that every window that opens after the first one uses the shell environment and does not inherit the first window environment if that was launched from the terminal. Nevertheless, that still might need careful explanation as to what happens when you change the folder from within the window. Some users might expect the setting to apply there too and some maybe not. |
(Unrelated: @segevfiner can you send me a hello email to joao moreno at my company com?) |
Could be, not sure who may or may not depend on this. I'm just basing this on how I expect it to behave, with each window just taking the environment from whatever way you launch. The first launch thing is really an implementation detail IMHO. And yeah there is also the case of changing a folder in an existing window as opposed to a new one. You described just preserving the environment the window started with (Unrelated to the first launch), which makes sense. |
I just think it could be frustrating to setup a nice environment when you start VSCode from the terminal and then only getting it in the first window. Don't forget that we do potentially restore more than one window on startup, so in that case we cannot just apply the environment only to the first window and treat the others as new window. This would need a lot of careful tweaking to get right and I am not sure it is worth it and may be more confusing than helpful. At least today we have a somewhat consistent behaviour. |
(Unrelated: @joaomoreno Not sure I follow what that email address is, but you can find my gmail email address on my commits) |
@bpasero There are cases for both behaviours I guess. On restoring a session you indeed want the environment appplied to all the restored windows. But also imagine keeping VS Code running for a long time then opening a new window and getting some virtualenv from something that you worked on long ago that happened to be the first launch. I think in macOS it might even keep that process/VS Code open even when no windows are open (Not sure it does so currently). |
I think this will not be adoptable in the configuration resolver service (used for |
@alexr00 can you clarify what kind of |
@alexr00 Couldn't these settings assume the pre-resolved values at first and then emit configuration change events whenever the user shell env gets resolved? |
@bpasero one of the possible variables is @joaomoreno it looks like might only be terminal setting that use this. I would need to defer to the settings owners to know if that would be ok. |
Since I am not sure we can adopt this in a timely manner, I have meanwhile pushed a couple of changes to
|
@bpasero the only reason why When reviewing the implementation, I noticed that the delete part no longer worked: it seems that another merge happening later undoes the delete. I've removed the no-longer working |
* Make easy adoptions of async configuation resolver service Part of #108804 * Also adopt in exthostDebug * Add another terminal adoption
I have looked at the The remaining work is in terminals and configuration resolvers 👍 |
* Make easy adoptions of async configuation resolver service Part of #108804 * Also adopt in exthostDebug * Add another terminal adoption
…#120326) * Make easy adoptions of async configuation resolver service Part of microsoft#108804 * Also adopt in exthostDebug * Add another terminal adoption
Pretty sure terminal done now 🎉 |
With some help from @Tyriar, I'm pretty sure that the configuration resolver is also done now. |
Thanks a lot ❤️ |
We will take out the process environment patching early May to get a good milestone of coverage. |
Just out of curiosity, is there any way to just permanently ignore the "taking too long" warning message..? I ask because I'm required to use a Mac at work (I really prefer Linux myself), but the machine I've been given to use is a late 2013 Intel i5 iMac 27". This thing is stupidly slow at the best of times, I've timed a cold boot at a little over 3 minutes, multiple times. So I know it's slow, I don't need another notification telling me that every time I open a VSCode instance, which quite often involves multiple instances at the same time.. |
Yes, switch to insiders where this notification no longer appears: https://code.visualstudio.com/insiders/ |
Details: #106537 (comment)
Today: The workbench depends on user env to be resolved. Resolving user env envolves spawning a shell and executing the user's init scripts. This can take long.
Ideally: The user env is only required for specific features: opening terminals, spawning tasks, spawning extension host. Until it's resolved, many other features should actually work, ie explorer, editor, etc.
Related:
Adoption
I made a pass over usages of process environment by looking at:
process.env
IProcessEnvironment
vs/base/parts/ipc/node/ipc.cp
that spawn child processesAssigning people based on areas and usages. Feel free to remove yourself and your items when this change needs no adoption in your area.
Terminal @Tyriar @meganrogge
vs/base/node/shell.ts
@TylerLeonhardtDebug @weinand
vs/workbench/contrib/debug/browser/rawDebugSession.ts
vs/workbench/contrib/debug/node/debugAdapter.ts
(only runs in EH -> nothing to do)Tasks @alexr00
vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
vs/workbench/services/configurationResolver/electron-sandbox/configurationResolverService.ts
Proxy @chrmarti
vs/platform/request/node/proxy.ts
vs/workbench/services/extensions/node/proxyResolver.ts
Child Processes
The text was updated successfully, but these errors were encountered: