提交 e3d8b0bd 编写于 作者: C CyrusNajmabadi

Hide text changes.

上级 2340d881
......@@ -32,7 +32,7 @@ private abstract class AddImportCodeAction : CodeAction
/// <summary>
/// The changes to make to <see cref="OriginalDocument"/> to add the import.
/// </summary>
protected readonly ImmutableArray<TextChange> TextChanges;
private readonly ImmutableArray<TextChange> _textChanges;
protected AddImportCodeAction(
Document originalDocument,
......@@ -41,16 +41,16 @@ private abstract class AddImportCodeAction : CodeAction
CodeActionPriority priority)
{
OriginalDocument = originalDocument;
TextChanges = textChanges;
Title = title;
Tags = tags;
Priority = priority;
_textChanges = textChanges;
}
protected async Task<Document> GetUpdatedDocumentAsync(CancellationToken cancellationToken)
{
var oldText = await OriginalDocument.GetTextAsync(cancellationToken).ConfigureAwait(false);
var newText = oldText.WithChanges(TextChanges);
var newText = oldText.WithChanges(_textChanges);
var newDocument = OriginalDocument.WithText(newText);
return newDocument;
......
......@@ -73,8 +73,10 @@ private async Task<Solution> GetUpdatedSolutionAsync(CancellationToken cancellat
protected override async Task<IEnumerable<CodeActionOperation>> ComputeOperationsAsync(
CancellationToken cancellationToken)
{
var updatedDocument = await GetUpdatedDocumentAsync(cancellationToken).ConfigureAwait(false);
var oldText = await OriginalDocument.GetTextAsync(cancellationToken).ConfigureAwait(false);
var newText = oldText.WithChanges(TextChanges);
var newText = await updatedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false);
return ImmutableArray.Create<CodeActionOperation>(
new InstallPackageAndAddImportOperation(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册