Skip to content
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

deleted editorOpenWith #116494

Closed
wants to merge 1 commit into from
Closed

deleted editorOpenWith #116494

wants to merge 1 commit into from

Conversation

lramos15
Copy link
Member

This PR fixes #116272.

I have moved the openWith function into the IEditorGroup and all the extra functions and helpers into editor.ts. I still need to add the unsaved file dialog.

@bpasero I'm a bit confused as I feel parts of #116272 contradict #100821, specifically the portion about passing in an override option that shows the picker "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". Would then openWith in the IEditorGroup not have any picker logic and instead be used just for opening a specific editor given an ID? Or would we say if there is no ID we pass that into the editorService to show the picker instead of the picker logic living within that function.

@lramos15 lramos15 added the debt Code quality issues label Feb 11, 2021
@lramos15 lramos15 added this to the February 2021 milestone Feb 11, 2021
@lramos15 lramos15 self-assigned this Feb 11, 2021
Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall but make sure @bpasero signs off too

@@ -631,6 +631,13 @@ export class TestEditorGroupsService implements IEditorGroupsService {
export class TestEditorGroupView implements IEditorGroupView {

constructor(public id: number) { }
preferredHeight?: number | undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Do you need to add these properties? They look unrelated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same feelings.

@@ -472,6 +472,14 @@ export interface IEditorGroup {
*/
openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, context?: OpenEditorContext): Promise<IEditorPane | null>;

/**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Move the JSDoc for the parameters to this interface

/**
* Get the group to open the editor in by looking at the pressed keys from the picker.
*/
export function getTargetGroup(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I think this function is only used in one spot so let's move it to that file instead

/**
* Get a list of all available editors, including the default text editor.
*/
export function getAllAvailableEditors(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] same for this function. I think it is only used in openEditorWith

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given a high level review feedback here before drilling into the code itself: I think openEditorWith should not be inside editorGroupView but rather be something I can pass to IEditorService#openEditor as an option. We already have the override property that I can pass to indicate which editor to use:

override?: false | string;

In my mental model, an editor group should really not be involved with figuring out which editor to use for a given input. The editor group already deals with typed EditorInput that have an exact mapping to 1 editor. I would have rather expected the editor service to convert to the correct EditorInput (from a { resource } untyped input) based on:

  • override
  • user settings (editor associations)
  • extensions

@@ -631,6 +631,13 @@ export class TestEditorGroupsService implements IEditorGroupsService {
export class TestEditorGroupView implements IEditorGroupView {

constructor(public id: number) { }
preferredHeight?: number | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same feelings.

@joaomoreno joaomoreno changed the base branch from master to main February 15, 2021 08:51
@lramos15
Copy link
Member Author

Closing in favor of #116856 as I basically needed to restart so it was easier.

@lramos15 lramos15 closed this Feb 17, 2021
@lramos15 lramos15 reopened this Feb 17, 2021
@lramos15 lramos15 closed this Feb 17, 2021
@lramos15 lramos15 deleted the moveOpenWith branch February 17, 2021 15:06
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revisit editorOpenWith living on its own
3 participants