-
Notifications
You must be signed in to change notification settings - Fork 30k
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 access/update the storage state directly #96939
Comments
Agree. Wouldn't a better approach be to propagate this default layout to the related components and let them take care without writing to storage service at all? I feel this should be taken as a default value when no other storage value is present but not go through the storage service at all. In other words, I would not expect any storage service involvement to get this default layout working ideally. |
Yes, that's what I have in my mind too. Layout service can have an API to expose default layout and corresponding components (ActivityBarPart, ViewContainerModel) can read this and add to their state.
💯 It should be similar to our configuration model - Default -> User (Storage). |
@eamodio as discussed here is a list of related debt I would like to report:
|
Per conversations with @bpasero & @sandy081 were are simplifying/reducing the features of the default layout api and expanding on the default editors api. Here is the new api: interface IDefaultLayout {
readonly views?: IDefaultView[];
readonly editors?: IDefaultEditor[];
}
interface IDefaultView {
readonly id: 'explorer' | 'run' | 'scm' | 'search' | 'extensions' | 'remote' | 'terminal' | 'debug' | 'problems' | 'output' | 'comments' | string;
}
interface IDefaultEditor {
readonly uri: UriComponents;
readonly openOnlyIfExists?: boolean;
readonly viewType?: string;
}
Internally we will be replacing the current tweaking of storage keys from the default layout code, into specific apis exposed by the view service. |
@eamodio What is the id of |
Current the old code paths still exist, but once Codespaces migrates to the new api I can remove all of that.
I made it an object rather than just the string in case we need to add more information to it after (e.g. extension id -- so that we could possibly improve performance) |
@eamodio I feel I could have contributed to this work or participate in discussion. Can we turn this into a PR and work on it together? I feel this more efficient compared to me opening issues or even making the changes myself on top. In particular in this case I find it weird that the workbench is responsible for opening views as instructed by the default layout, I feel this code should live inside the view or panel service? Now we seem to be restoring views first, and then viewlets? |
@bpasero Sorry for not updating you. On Wednesday We (@eamodio , @sbatten & Myself) discussed about implementing default layout for views and we came to following conclusions:
Re: PR - Yeah, agreed that if there is a PR that one of us could give the feedback. |
Restoring is the state owned by layout and hence I think it makes sense the layout service restore views/viewlets based on its previous/default state. I do not think we need to restore viewlets anymore as restoring/opening views restore/open viewlets. |
I see why we need to restore viewlets, I take it back. This is needed for restoring previous state. |
Thanks Sandy for clarification, I suggest we can take this offline, will follow up with Eric. I opened #99972 to remove the restore logic from |
Storage state is changed directly by the layout service while applying the default layout. Eg:
vscode/src/vs/workbench/browser/layout.ts
Lines 636 to 642 in 6d70b4f
I do not think this is the right way to access/update the state that is internal to a specific component/service. This will break if the corresponding component/service changes its semantics. Worst that corresponding component/service owner will not be aware that something is broken. It seems keys are also hardcoded 😞
Right way to do this is to add APIs to corresponding services and let the services change their state.
I would strongly recommend to change this at the earliest.
@bpasero @sbatten FYI
The text was updated successfully, but these errors were encountered: