Repository navigation
Set override to false when reopening editors after dragging them to a different editor group - #114093
Merged
Matt Bierner (mjbvz) merged 1 commit intoJan 11, 2021
Conversation
… different editor group. This fixes microsoft#109000.
Contributor
|
Thanks! The custom editor logic is complicated because custom editors were bolted into a codebase that was built around text editors (and the assumption that every resource has a single editor, instead of multiple potential editors) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This seems to fix #109000.
Apparently this also prevents custom editor webviews from being recreated when they are moved to a different editor group 🎉
This is the behavior without this patch (notice the slow loading times):
This is with this patch (no loading times anymore at all):
It seems like this enables all webviews to be dragged around with zero costs which would be super awesome 😮
This was not that smooth before - the entire webview used to reload!
I only understand a tiny fraction of the custom editor logic, so this fix might have undesired consequences though.
Off-topic
It seems to me that the custom editor contribution is very complicated. I found the override mechanism to be hard to follow and to debug and after some debug sessions, I thought #109000 was nothing that could be easily fixed by the community.
From my understanding, this is a part of the control flow when a new custom editor is opened:
DelegatingEditorService.openEditoris called by the UI and callsEditorGroupView.openEditorwhich triggers the eventEditorGroupView.onWillOpenEditorand thus the listenerEditorService.onGroupWillOpenEditor, which notifies all open editor handlers, includingCustomEditorContribution.onEditorOpening/.onResourceEditorOpening, which callsCustomEditorService.openWith/.openEditorForResource, which callsEditorService.openEditorwhich calls then again (recursively, see (2), but with different arguments)EditorGroupView.openEditorwhich again triggers theEditorGroupView.onWillOpenEditorevent and the listenerEditorService.onGroupWillOpenEditor, which notifies all open editor handlers again, again includingCustomEditorContribution.onEditorOpening, which stops, as the editor already is aCustomEditorInput.If I got it correctly, a
FileEditorInputis always created in this scenario, and sometimes, custom editors prevent the file editor from being rendered by creating their ownCustomEditorInputand recursively callingEditorService.openEditorto show this input.I'm curious (with my very limited understanding) - what is the advantage of this design over just having default editors and custom editors both being specializations of some abstract editor view? This would get rid of the recursion. I don't find it trivial at all that a simple
override: falsefixes this issue.