public static async Task <Solution> RenameSymbolAsync( Solution solution, ISymbol symbol, string newName, OptionSet optionSet, CancellationToken cancellationToken = default) { if (solution == null) { throw new ArgumentNullException(nameof(solution)); } if (symbol == null) { throw new ArgumentNullException(nameof(symbol)); } if (string.IsNullOrEmpty(newName)) { throw new ArgumentException(nameof(newName)); } var resolution = await RenameSymbolAsync( solution, symbol, newName, RenameOptionSet.From(solution, optionSet), nonConflictSymbols : null, cancellationToken).ConfigureAwait(false); // This is a public entry-point. So if rename failed to resolve conflicts, we report that back to caller as // an exception. if (resolution.ErrorMessage != null) { throw new ArgumentException(resolution.ErrorMessage); } return(resolution.NewSolution); }
public static async Task <Solution> RenameSymbolAsync( Solution solution, ISymbol symbol, string newName, OptionSet optionSet, CancellationToken cancellationToken = default) { if (solution == null) { throw new ArgumentNullException(nameof(solution)); } if (symbol == null) { throw new ArgumentNullException(nameof(symbol)); } if (solution.GetOriginatingProjectId(symbol) == null) { throw new ArgumentException(WorkspacesResources.Symbols_project_could_not_be_found_in_the_provided_solution, nameof(symbol)); } if (string.IsNullOrEmpty(newName)) { throw new ArgumentException(nameof(newName)); } var resolution = await RenameSymbolAsync( solution, symbol, newName, RenameOptionSet.From(solution, optionSet), nonConflictSymbols : null, cancellationToken).ConfigureAwait(false); // This is a public entrypoint. So if rename failed to resolve conflicts, we report that back to caller as // an exception. if (resolution.ErrorMessage != null) { throw new ArgumentException(resolution.ErrorMessage); } return(resolution.NewSolution); }
internal static Task <RenameLocations> FindRenameLocationsAsync( Solution solution, ISymbol symbol, OptionSet optionSet, CancellationToken cancellationToken) { return(RenameLocations.FindLocationsAsync( symbol, solution, RenameOptionSet.From(solution, optionSet), cancellationToken)); }