Today our editor override works very late as part of the openEditor. This has a couple of issues:
- we end up calling each contributed override whenever an editor opens, even when you just click on a tab
- you end up with re-entrant
openEditor calls from within the override
- the input that was originally used for the
openEditor call is never disposed
- the caller of
openEditor might get a very unexpected result from what was originally passed in
If we had a way to override the editor at the level of where the input is created things would be cleaner.
Proposal:
- we remove the override event and override handling from
editorGroupView#openEditor altogether, instead the rule is that the EditorInput that is passed into a group for opening is the correct one
- we enrich the
IEditorService with support for converting a URI into a EditorInput including custom editors, this can easily be added to the existing IEditorService#createEditorInput method
- we leverage the custom editor input factories for this purpose that are already registered to convert a
URI into the EditorInput
- we allow to pass in a special
override option that will bring up a picker to pick a custom editor (this essentially moves the picker logic from openEditorWith into IEditorService
- for the case of "Reopen with..." we can use the same concepts: by calling
IEditorService.replaceEditors(activeEditor, { resource: activeEditor.resource, options: { override: <show picker> }) everything should just work
- we adopt this concept for all editors that are not standard: notebooks, custom editors, search editors, settings editor
- bonus: we can think about merging the
fileInputFactory and customInputFactory into one so that we just have 1 way of resolving an editor input from a resource and not 2
Today our editor override works very late as part of the
openEditor. This has a couple of issues:openEditorcalls from within the overrideopenEditorcall is never disposedopenEditormight get a very unexpected result from what was originally passed inIf we had a way to override the editor at the level of where the input is created things would be cleaner.
Proposal:
editorGroupView#openEditoraltogether, instead the rule is that theEditorInputthat is passed into a group for opening is the correct oneIEditorServicewith support for converting aURIinto aEditorInputincluding custom editors, this can easily be added to the existingIEditorService#createEditorInputmethodURIinto theEditorInputoverrideoption that will bring up a picker to pick a custom editor (this essentially moves the picker logic fromopenEditorWithintoIEditorServiceIEditorService.replaceEditors(activeEditor, { resource: activeEditor.resource, options: { override: <show picker> })everything should just workfileInputFactoryandcustomInputFactoryinto one so that we just have 1 way of resolving an editor input from a resource and not 2