-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Remove editorOpenWith #116856
Remove editorOpenWith #116856
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <benjamin.pasero@gmail.com>
Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
- 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.
@@ -570,7 +570,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lramos15 fyi destructuring even undefined
is fine
@lramos15 @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven no idea, it didn't seem to change anything for me. Maybe @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 @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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Why does this constant need to be inlined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It breaks layering, as everywhere else this is used is in browser
displayName: nls.localize('promptOpenWith.defaultEditor.displayName', "Text Editor"), | ||
providerDisplayName: builtinProviderDisplayName, | ||
providerDisplayName: nls.localize('builtinProviderDisplayName', "Built-in"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Try extracting this string since it it used in two places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: (@bpasero feel free to correct me if I'm wrong 😄 )
createEditorInput