-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: enable switching workspace storage in web #252
feat: enable switching workspace storage in web #252
Conversation
d2f71dc
to
02d493a
Compare
Perhaps I could even try opening a PR to VSCode to support this 😂 |
Let's see 😇 |
How do you use it in your code? |
Whenever a user switch between a project, we don't reload the window. That's because we allow people to already type in the editor, and in the background we create the new project and then apply those changes. Purely UX reasoning. We do want the new workspace storage to apply to the new project though, so whenever the project changes, we do this: runWithLatestMonacoConfig(async (config) => {
return config.pitcher.onInstanceChanged(({ instanceId }) => {
const workspaceIdentifier = monacoConfigToWorkspaceIdentifier(
config,
instanceId,
);
const storageService = StandaloneServices.get(IStorageService);
storageService.switch(workspaceIdentifier, true).then(() => {
reinitializeWorkspace(workspaceIdentifier);
});
});
}); |
How do you update the workspace in the workspace/configuration service? |
In the meantime, instead of changing the vscode impl, what about extending it into a |
So I would extend the original
That's what |
Ok it seems harmless anyway, please resolve the conflicts and let's merge it! We really need a better way to handle that vscode patch though, separating each change with an explanation. I'm not sure that's the best solution... |
02d493a
to
021a73c
Compare
021a73c
to
320e92d
Compare
Yeah, I was thinking about this as well. Maybe we can do something like this? I love that they say per patch why the patch is there. |
Rebased! |
How do they manage it? |
This is a more... controversial PR. In CodeSandbox I want to add the ability to seamless switch between workspaces, without refreshing. To enable this, I need to call
switch
on theStorageService
, but workspace switching was never implemented for the web storage service! I implemented it in VSCode, and I verified that this works really well, but I also realise that this will make upgrades in the future harder.The first approach I tried was copying all the code from the existing storage service in our code base, and making the changes there, but not enough services/utilities are exposed to do this. I'm happy to discuss other approaches.