Repository navigation
Remove editorOpenWith - #116856
Remove editorOpenWith#116856
Conversation
There was a problem hiding this comment.
I glanced over the changes and left some feedback. I think large chunks of code such as IEditorService#openEditorWith would simplify much once we have a way to return custom editor inputs from the createEditorInput flow. In my mind, the only logic editor service should have is to know which editor input to create based on overrides and picks. But that is a follow up step to consider as we have already discussed.
Besides, there are some types and interfaces I fail to find a good place for. I don't really understand the IConfigurationNode for custom editors, nor why schemas have to change. All of this stuff should really not be inside the editor service but in some registry outside. Same goes for constants defined in editor.ts.
I think my biggest issue in this area now is that I see code and concepts that I have not seen before (because I did not author them), making it hard for me the reason about them.
Ideally we can clean this up with existing patterns we have 👍
Co-authored-by: Benjamin Pasero <[email protected]>
Co-authored-by: Benjamin Pasero <[email protected]>
- OverrideOptions => EditorOverride - It is safe to destructure (...) undefined - Ensure when destructuring, override is always winning - Not a big fan of shared builtinProviderDisplayName import
This moves the relevant code out of the editor service.
|
|
||
| const fileEditorInput = this.createEditorInput({ resource, forceFile: true }); | ||
| const textOptions: IEditorOptions | ITextEditorOptions = options ? { ...options, override: OverrideOptions.DISABLED } : { override: OverrideOptions.DISABLED }; | ||
| const textOptions: IEditorOptions | ITextEditorOptions = { ...options, override: EditorOverride.DISABLED }; |
There was a problem hiding this comment.
Logan Ramos (@lramos15) fyi destructuring even undefined is fine
|
Logan Ramos (@lramos15) Matt Bierner (@mjbvz) ok, I went over all the code and pushed changes to align with existing patterns. Please do a thorough review and testing of the following changes:
I will file follow up debt issues for related things I noticed that are beyond the scope of this PR. |
| } | ||
|
|
||
| // Collect all overrides for resource | ||
| const allEditorOverrides = this.getEditorOverrides(resource, undefined, undefined); |
There was a problem hiding this comment.
Should this call forward the options and group from the openEditor call or why is undefined explicitly passed in?
There was a problem hiding this comment.
I haven no idea, it didn't seem to change anything for me. Maybe Matt Bierner (@mjbvz) knows
|
Commenting on your proposed next steps:
Yeah possibly. However in #117207 I noticed that actually only custom editors seem to use
I reported #117208 to look into that. If we have the concept of letting the user pick a custom editor as part of the open editor flow, we probably have to make
Yes, 💯 , and that is #100281
Yes, maybe also settings editor. |
|
This looks a lot cleaner for me. Thank you to Benjamin Pasero (@bpasero) for putting the pieces together that I couldn't quite figure out. I will utilize debt week to improve on this more based on the above comments. |
Matt Bierner (mjbvz)
left a comment
There was a problem hiding this comment.
Looks good overall to me. Nice work!
|
|
||
| export const defaultCustomEditor = new CustomEditorInfo({ | ||
| id: DEFAULT_EDITOR_ID, | ||
| id: 'default', |
There was a problem hiding this comment.
[nit] Why does this constant need to be inlined?
There was a problem hiding this comment.
It breaks layering, as everywhere else this is used is in browser
| id: 'default', | ||
| displayName: nls.localize('promptOpenWith.defaultEditor.displayName', "Text Editor"), | ||
| providerDisplayName: builtinProviderDisplayName, | ||
| providerDisplayName: nls.localize('builtinProviderDisplayName', "Built-in"), |
There was a problem hiding this comment.
[nit] Try extracting this string since it it used in two places
There was a problem hiding this comment.
That is probably on me, I wasn't sure about the benefit of sharing NLS strings here. If we have a concept of built-in custom editors, shouldn't we rather have a flag to indicate as such and then maybe put the label in one central place?
This PR outlines part of the solution to #116272.
This removes the use of openWith and adds additional functionality to
openEditor.The next steps are to: (Benjamin Pasero (@bpasero) feel free to correct me if I'm wrong 😄 )
createEditorInput