private static async Task <Solution> MoveDocumentToFolderAsync(MoveDocumentCodeActionContext context, CancellationToken cancellationToken) { var solution = context.Solution; var document = solution.GetDocument(context.DocumentId); var projectId = document.Project.Id; solution = solution.RemoveDocument(context.DocumentId); solution = solution.AddDocument(DocumentId.CreateNewId(projectId), $"{context.Name}.cs", await document.GetTextAsync(cancellationToken), context.Folders); return(solution); }
public MoveDocumentCodeAction(MoveDocumentCodeActionContext fixContext) { _fixContext = fixContext; _folder = fixContext.Folders.Join(@"\"); if (!string.IsNullOrWhiteSpace(_folder)) { _folder = "\\" + _folder + "\\"; } _name = fixContext.Name; }