I'm writing a Roslyn Vsix to add localizable string to the closest resource file. I'm having issues adding to the resource file because that operation is done by writing xml, and not using the Roslyn API. So I'm finding that preview changes is populating my RESX when I only want that to occur when we are applying changes.
After some research it seems the changes are applied by calling apply on the ApplyChangesOperation, When I Create a custom code action, it is not called:
public class DelayedApplyChangesOperation : CodeActionOperation
{
public override void Apply(Workspace workspace, CancellationToken cancellationToken)
{
using (var file = new System.IO.StreamWriter("c:\\temp\\test.txt"))
{
file.WriteLine("Lines and Stuff");
}
Debug.WriteLine("Test Execution");
}
}
Being that ApplyChangesOperation
is sealed I cannot inherit from it. How can I create a Custom CodeActionOperation, that is called when the changes are applied to a solution,