-
Notifications
You must be signed in to change notification settings - Fork 390
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
Enhance unused reference feature to support undo/redo #6795
Comments
@JoeRobich
The undo/redo should keep the history of all actions or only the last action ? |
Roslyn would be responsible for adding the undo/redo action. We need to work out the best way to support undo/redo.
|
I think the interface should add undo/redo methods and call dotnet ProjectSystem to do |
@ocallesp Can you describe how this would work end-to-end? Would you be storing state in the CleanupService or would we be passing some state when calling Undo/Redo? |
ProjectSystem can store the state in the CleanupService |
@vatsalyaagrawal Thanks for sharing. I assume your team is hooking up to the undo/redo stack and you will call us when needed. Is that correct? cc: @ocallesp |
UX update: I met with UX and they mentioned that we dont need a dialog - just having |
@mikadumont what is the expectation on this scenario?
What is the result? |
@jjmew Ctrl-Z should only undo the last operation. In this case it should restore the X, Y, Z references. |
@jodavis what about the 4th "Ctrl Z" . Should it re-add references A,B,C? |
@jjmew That is correct. I feel like we will need to keep some state information with each undo action that is pushed on the stack, so that we can properly track which changes need to be undone. |
@jodavis the expectation then is that the productivity team will request the project system to undo the last action on the "Remove Unused References" stack. We will add the references that we previously removed. Is there any error handling that you expect? for example if we were not able to re-add the references. |
@jjmew It would be coarse-grained but we could have the proposed |
The itemSpecification returned by Roslyn needs to fix the itemSpecification to use the one from This PR already implements the undo/redo #7065 |
I met with Osvaldo and to discuss the implementation and we have agreed on adding the following interface changes. interface IProjectSystemUpdateReferenceOperation
{
Task<bool> ApplyAsync();
Task<bool> RevertAsync();
}
interface IProjectSystemReferenceCleanupService2
{
Task<IProjectSystemUpdateReferenceOperation> GetUpdateReferenceOperationAsync(
string projectPath,
ProjectSystemReferenceUpdate referenceUpdate,
CancellationToken canellationToken);
} Roslyn will request update actions for each of the changes from the Project System. We will then apply the actions and push an Undo action onto the UndoManager which will contain all the actions for the Remove Reference invocation. |
Implementations of |
@ocallesp do you recall which version this was fixed in? |
We would like the API implemented in #6692 enhanced with the ability to re-add a reference that has been removed.
One possibility is a new
UpdateAction.Add
In particular the call to
IProjectSystemReferenceCleanupService.GetProjectReferenceAsync
would need to be enhanced so that we capture enough information about each reference that it could be recreated from the ProjectSystemReferenceInfo model. This information may need to include the position in the project file where the reference would be inserted. Next theIProjectSystemReferenceCleanupService.TryUpdateReferenceAsync
would need to be updated to support anProjectSystemUpdateAction.Add
scenario where, given this enhacned ReferenceInfo model, a reference is added to the project file.Another possibility is that we share the same undo context
The
IProjectSystemReferenceCleanupService.TryUpdateReferenceAsync
could return a OleUndoUnit or we could pass in a UndoTransaction of sorts.Tracked in DevOps 1348735
The text was updated successfully, but these errors were encountered: