public CodeActionEdit GetEdit(CancellationToken cancellationToken = new CancellationToken()) { // First find the document containing the method declaration. var document = FindContainingDocument(); // Use the rewrite visiter to change the target method declaration. var newRoot = new AddReturnValueRewriter(declaration, handledTypeName.Item1, handledTypeName.Item2). Visit((SyntaxNode) document.GetSyntaxRoot()); // Update the document with the new root and return the code action. document = document.UpdateSyntaxRoot(newRoot); return new CodeActionEdit(document); }
public CodeActionEdit GetEdit(CancellationToken cancellationToken = new CancellationToken()) { // Use the rewrite visiter to change the target method declaration. var newRoot = new AddReturnValueRewriter(declaration, invocation, typeNameTuple.Item1, typeNameTuple.Item2). Visit((SyntaxNode) document.GetSyntaxRoot()); // Update the document with the new root and return the code action. var updatedDocument = document.UpdateSyntaxRoot(newRoot); var updatedSolution = document.Project.Solution.UpdateDocument(updatedDocument); return new CodeActionEdit(null, updatedSolution, ConditionCheckersUtils. GetRemoveCodeIssueComputerOperation(computer)); }