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

Use the UndoRedoService for CustomEditors #92408

Merged
merged 3 commits into from Mar 12, 2020

Conversation

mjbvz
Copy link
Contributor

@mjbvz mjbvz commented Mar 10, 2020

For #90110

Changes custom editors (the ones not based on text) to use the UndoRedoService. This involved:

  • Moving edit lifecycle back into the main process again (this is actually the bulk of the changes in this PR)
  • Removing the undo/redo methods on CustomEditorModel since they are no longer required
  • Using the UndoRedoService to trigger undo/redo

For microsoft#90110

Changes custom editors (the ones not based on text) to use the UndoRedoService. This involved:

- Moving edit lifecycle back into the main process again (this is actually the bulk of the changes)
- Removing the `undo`/`redo` methods on  `CustomEditorModel`
- Using the undoRedoService to trigger undo/redo
@mjbvz mjbvz requested a review from alexdima March 10, 2020 23:39
@mjbvz mjbvz self-assigned this Mar 10, 2020
Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have focused on the call to the undo-redo service. And that looks OK, just a small nitpick regarding the label (see other comment).

There is one thing missing here, I would have expected to see also a call to IUndoRedoService.removeElements. That call should be done to clear the undo/redo stack elements when a file gets closed, etc... in order to avoid a memory leak

this._undoService.pushElement({
type: UndoRedoElementType.Resource,
resource: this.resource,
label: 'Undo',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label will be used in the context "Undo {0}", so it would be better if it was called "Edit", because now it might be presented as "Undo Undo"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. I'll also investigate getting the label from extensions

@mjbvz mjbvz merged commit 3ef02fe into microsoft:master Mar 12, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants