Pass EditorWidgetFactory options to TextEditorProvider#9754
Pass EditorWidgetFactory options to TextEditorProvider#9754colin-grant-work wants to merge 1 commit intomasterfrom
EditorWidgetFactory options to TextEditorProvider#9754Conversation
Signed-off-by: Colin Grant <colin.grant@ericsson.com>
|
I want to add some caveats / discussion points here:
|
| const options = this.createOptions(this.diffPreferencePrefixes, modified.uri, modified.languageId); | ||
| options.originalEditable = !original.readOnly; | ||
| options.readOnly = modified.readOnly; | ||
| options.alwaysRevealFirst = Boolean(factoryOptions?.selection); |
There was a problem hiding this comment.
This line is the actual fix. It needs to be known when the DiffNavigator is created because it's supposed to be private and inaccessible thereafter.
There was a problem hiding this comment.
I can confirm that the issue exists on master and is fixed by this change:
- Using the testing steps provided, the diff view is opened with the first change select ✔️
- Other diff views (scm/compare opened editors) continue working as expected ✔️
This solution involves some dubious work to get around the implementation of the
WidgetManager
The code looks alright to me. I don't see a way around that right now.
Using the Create file-copy command I noticed that the copied file is opened twice in the same area. Though this is not related to this change and also happens on master.
|
Closing for now. It does fix the problem, and may be a reasonable solution, but only if the underlying changes solve more problems than just this one. |
What it does
This PR fixes #9746 by giving
DiffEditors knowledge of the options used to create them. This allows them to set the correct value foralwaysRevealFirstin the options passed to theDiffNavigator. It may also make it possible to fix some of the lifecycle difficulties we previously had withEditorManager.revealSelectionin a manner more consistent with VSCode's / Monaco's approach.How to test
Review checklist
Reminder for reviewers
Signed-off-by: Colin Grant colin.grant@ericsson.com