Auto open diff editor on Refactor Preview #159283
Open
+78
−3
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.
Auto opens the Diff Editor when Refactor Preview panel is displayed.
The opening is initiated when the BulkEditPane is created -> when Tree with Edits are populated, by passing the current input into the
this._openEditorOnFirstApplicableEdit
. This function retrieves either the first checked edit (TextEditElement), if there is any, or the first FileElement if there is none checked.Assuming that the refactor preview opens only if there is
needsConfirmation
flag set on at least oneWorkspaceEdit
, but the edits that require confirmation are not checked by default, so they would not be visible in the opened Diff Editor, it makes more sense to try to open the edit that is checked/visible.Only if all edits would require confirmation, then the first file would be opened.
The Diff editor should automatically reopen on subsequent reopening of the Refactor Preview panel, if it is not already in view.
onDidFocus
makes sure that if the_activeEditor
exists, and is not visible would be reopened.To allow this functionality to work for both Editors that can open from BulkEdits, group has been added as well to the deletion editor.
Both
_editorService.openEditor()
in_openElementAsEditor()
have beenawaited
, so their reference can be used to reopen the DiffEditor.fixes #158408
fixes #159327