You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #116856 I spent some though on the custom editor input factory. The only usecase today seems to be for restoring backups (via BackupRestorer).
I would think that a better place for this would be IEditorService#createEditorInput and the backup restorer should just use that. If we need to make this method async for a few usecases I think that is OK, as long as the signature could stay sync for most typical uses.
Overall I think we should merge the ICutomEditorInputFactory into the existing IEditorInputFactory and not have 2 concepts.
Yes, I have to say that I can't wrap my head around this. I don't understand why notebooks must register a IEditorInputFactoryandICustomEditorInputFactory and I am failing to fix #117899 because not of this is intuitive to me.
Isn't the idea of an editor input to abstract away editors? And isn't an input factory a way to revive a serialised input into an alive object? That sounds a like pretty good abstraction and something must be very wrong with it if we now require the same abstraction again, just for custom editors.
Marking all of this as important because this is crucial to the notebooks effort and playing the catch-up game of copy-pasting source code isn't sustainable.
Benjamin Pasero (@bpasero) We should probably set up another meeting to discuss this as I don't think there's a good solution here. After discussion we weren't able to merge these ideas.
Yeah I think this might need some more discussion with custom editor + notebook people why the viewType is needed so early on for the editor input to work.
Isn't the idea of an editor input to abstract away editors? And isn't an input factory a way to revive a serialised input into an alive object? That sounds a like pretty good abstraction and something must be very wrong with it if we now require the same abstraction again, just for custom editors.
Yes exactly, an editor input should be sufficient to open an editor and it shouldn't require an async lookup into backups. The flow should be:
editor input gets created (either from a backup that was found or because it was opened previously)
editor opens (text, notebook or custom)
in the resolve method you can do the actual lookup of what view type is needed
One thing that is special here is that the need for the custom editor input factory only applies to one case:
you open a folder and make editors dirty (text, custom, notebooks)
you close that window and exit without saving
from the command line you type code <folder> <file>
we only open the file and do not restore the other editors
but we still of course want to restore all editors that are dirty so we need this complicated flow of knowing how to actually create the inputs
Logan Ramos (@lramos15) maybe we can actually solve this differently in the end: if an editor ends up as backup it must be opened and as such we must have it as UI state somewhere. Instead of doing this complicated dance with the custom editor input factory, we can try to get the editor from that UI state instead. We can also think about simply restoring all previously opened editors as soon as we detect any dirty editor. In any case we can probably get rid of the custom editor input factory entirely 👍
I think we should tackle this for April and not have it on the Backlog.
Johannes Rieken (@jrieken) I'm removing the important label as I think we have at least blocked the catchup game with the new editorOverrideService.
Benjamin Pasero (@bpasero) Do you still want to try to tackle this in April? I'm not sure how important it is. It doesn't really improve the usability of the editorOverrideService from my understanding as we never operate on the backup case.
Activity
bpasero commentedon Mar 1, 2021
//cc Johannes Rieken (@jrieken)
jrieken commentedon Mar 1, 2021
related to #117899 (comment)
jrieken commentedon Mar 1, 2021
and related to #117873
jrieken commentedon Mar 2, 2021
Yes, I have to say that I can't wrap my head around this. I don't understand why notebooks must register a
IEditorInputFactoryandICustomEditorInputFactoryand I am failing to fix #117899 because not of this is intuitive to me.Isn't the idea of an editor input to abstract away editors? And isn't an input factory a way to revive a serialised input into an alive object? That sounds a like pretty good abstraction and something must be very wrong with it if we now require the same abstraction again, just for custom editors.
jrieken commentedon Mar 2, 2021
Marking all of this as important because this is crucial to the notebooks effort and playing the catch-up game of copy-pasting source code isn't sustainable.
lramos15 commentedon Mar 22, 2021
Benjamin Pasero (@bpasero) We should probably set up another meeting to discuss this as I don't think there's a good solution here. After discussion we weren't able to merge these ideas.
bpasero commentedon Mar 23, 2021
Yeah I think this might need some more discussion with custom editor + notebook people why the
viewTypeis needed so early on for the editor input to work.To follow up on Johannes Rieken (@jrieken) point:
Yes exactly, an editor input should be sufficient to open an editor and it shouldn't require an
asynclookup into backups. The flow should be:resolvemethod you can do the actual lookup of what view type is neededOne thing that is special here is that the need for the custom editor input factory only applies to one case:
code <folder> <file>fileand do not restore the other editorsLogan Ramos (@lramos15) maybe we can actually solve this differently in the end: if an editor ends up as backup it must be opened and as such we must have it as UI state somewhere. Instead of doing this complicated dance with the custom editor input factory, we can try to get the editor from that UI state instead. We can also think about simply restoring all previously opened editors as soon as we detect any dirty editor. In any case we can probably get rid of the custom editor input factory entirely 👍
I think we should tackle this for April and not have it on the Backlog.
lramos15 commentedon Apr 20, 2021
Johannes Rieken (@jrieken) I'm removing the important label as I think we have at least blocked the catchup game with the new
editorOverrideService.Benjamin Pasero (@bpasero) Do you still want to try to tackle this in April? I'm not sure how important it is. It doesn't really improve the usability of the editorOverrideService from my understanding as we never operate on the backup case.
bpasero commentedon Apr 21, 2021
Will update here once I looked into how to restore backups with the new
typeIdsupport.