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

Drag and drop custom editors to other windows issues #122996

Closed
bpasero opened this issue May 5, 2021 · 4 comments
Closed

Drag and drop custom editors to other windows issues #122996

bpasero opened this issue May 5, 2021 · 4 comments
Assignees
Labels
workbench-dnd Drag-and-drop issues workbench-editor-resolver Issues resolving the editor inputs
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented May 5, 2021

We have some code in fillResourceDataTransfers to fill the data transfer object for when the user drags an editor (or a file) to another window. That code among other things makes it possible to drag an editor to another window and have it open there (even if dirty).

One immediate issue is that a custom editor will not open as custom editor in the target window unless configured to be the default, so I think we would have to carry over the ID to use for override to know which editor to pick:

recording

The other (possibly bigger) issue is how to restore dirty contents in the target. We currently only support to preserve and restore textual content (here and here), but would need a different approach to support custom backups.

I would think that restoring dirty editors is P2 but the support for custom editor DND is something to look into first.

@bpasero bpasero added workbench-dnd Drag-and-drop issues custom-editors Custom editor API (webview based editors) labels May 5, 2021
lramos15 added a commit that referenced this issue May 19, 2021
@lramos15
Copy link
Member

@bpasero I added the drag and drop support for custom editors and notebooks. I really hate the way the typings came out and wonder if we should make a central viewType editor input. Let me know if we should make a separate debt issue for transferring dirty state.

@bpasero
Copy link
Member Author

bpasero commented May 19, 2021

@lramos15 I think we should not probe on properties of the editor input that we don't know about. Agree that we need a proper solution that does not require to probe on properties.

I never liked the name viewType and we already have typeId as property to know which editor to use for a given input. It almost seems to me that we have 2 competing concepts here:

  • typeId is used when the editor input is already resolved after the overrides have kicked in to find out the EditorPane to create to show the input
  • viewType when used as override allows the override handler to create the proper editor input
  • an editor input can only have one typeId but possible many viewTypes (?)

Somehow it feels weird that the editor input would provide such a property given that the viewType is the thing that was only used to find the right override?

I feel this needs some more thoughts...

Here is another idea: instead of putting the resource into the drag and drop transfer, why not literally use the editor serializer to product a JSON form of the input and then in the target unserialize?

@bpasero bpasero self-assigned this May 24, 2021
@bpasero bpasero added this to the May 2021 milestone May 24, 2021
@bpasero bpasero added workbench-editor-resolver Issues resolving the editor inputs and removed custom-editors Custom editor API (webview based editors) labels May 24, 2021
@bpasero
Copy link
Member Author

bpasero commented May 24, 2021

As outlined in #124394 (review) I think we should delegate to the editor what get's added into the transfer object.

@bpasero
Copy link
Member Author

bpasero commented May 25, 2021

via ab793cf

@bpasero bpasero closed this as completed May 25, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
workbench-dnd Drag-and-drop issues workbench-editor-resolver Issues resolving the editor inputs
Projects
None yet
Development

No branches or pull requests

2 participants