-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
Merge editor and editor resolver #153963
Comments
IDK - that means we push the notion of merge editors into workbench as a built-in concept. I am fine with that but IMO we are already paying much for abstractions and registrations (
@bpasero Why isn't this using the |
They are for creating an editor out of a We do not have to introduce the notion of merge editors if we can encode a merge editor input as a single resource, which is doable, but is a bit inconsistent with how diff editors work. Maybe Logan has an idea here how to proceed.
Will check and see what the reasons are. |
We thought about doing this for diff for the tabs API but it sounds messy. I think adding |
Where would that happen - in the |
|
So, that would mean we cannot be a contribution anymore and move into the core, right? I not really sure I see the grand scheme of things and why we need to register an editor in the first place. I know, I have done it for some very special in-merge-editor-code-navigation-logic (#153110) but it is not that we want to open a merge editor from the explorer or so |
You could keep it as a contrib if merge editors have a special schema that you would register instead. The reason I suggested it here as that would allow any arbitrary three resources to be opened in a three way merge. Registration also would enable |
The only reason merge editor would move into core is because text editors are registered in core and the merge editor is a text editor. We always had text editors in workbench core and never in The editor resolver abstracts underlying implementation by introducing the notion of untyped inputs. It does so by exposing the intent of an editor, but not its implementation: normal editor, diff editor, merge editor, untitled editor. I think having a merge editor as another kind is good, because - as I had said before - once we have a merge editor for notebooks, we could allow resolving a merge conflict in a dedicated notebook merge editor if the file is a notebook. When I look at the sources of the merge editor, I think the following structure could work:
|
This somewhat blocks #5770 because CLI support requires some generic untyped input to open on startup or into an existing window. If 👍 I can maybe work with Logan to get this in, but it would need the suggested move to vscode/src/vs/workbench/services/textfile/common/textEditorService.ts Lines 68 to 82 in e69176a
Not sure whether that would be possible Logan? |
Let's set up a sync to talk about this first. I am not really understanding the whole picture yet (e.g I wonder if notebooks, assuming they will have a merge editor, also move to core) |
From our meeting:
Some follow up ideas:
|
This was reverted and will re-land in August, @lramos15 can you recreate the PR? |
Recreated #156672 will keep as draft until I can ensure merge is working and the perf issues are ironed out |
This is somewhat related to #153110 and also #153340: today the new merge editor is not registering itself to the
IEditorResolverService
, except for that hack to enable opening the merge editor ad-hoc:vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.ts
Line 412 in 71b996e
This brings up a more general question: how would the merge editor register to the resolver, ideally I would like to do run this code to open a merge editor:
This follows our pattern of untyped editor inputs for opening.
We have similar support for opening diff editors via the untyped
IResourceDiffEditorInput
:vscode/src/vs/workbench/common/editor.ts
Lines 474 to 485 in 71b996e
Following the factory method of the resolver, I think we almost need to introduce a new factory method
createMergeEditorInput
, specifically for merge editors, which would then also theoretically enable us to do a merge editor for notebooks:vscode/src/vs/workbench/services/editor/common/editorResolverService.ts
Lines 142 to 149 in 71b996e
Btw: Untyped editor inputs enable a few nice features, such as dragging an editor and dropping it into a new window to "move" it there. Since we cannot serialize a typed editor input to the target window, we have to use the untyped variant. This works by calling the method
toUntyped
on a typed editor input (e.g. here for file inputs):The text was updated successfully, but these errors were encountered: