Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.CSharp
/// <summary>
/// Displays a symbol in the C# style.
/// </summary>
/// <seealso cref="T:Microsoft.CodeAnalysis.VisualBasic.Symbols.SymbolDisplay"/>
/// <seealso cref="T:Microsoft.CodeAnalysis.VisualBasic.SymbolDisplay"/>
#pragma warning restore CA1200 // Avoid using cref tags with a prefix
public static class SymbolDisplay
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' <summary>
''' Displays a symbol in the VisualBasic style.
''' </summary>
''' <seealso cref="T:Microsoft.CodeAnalysis.CSharp.Symbols.SymbolDisplay"/>
''' <seealso cref="T:Microsoft.CodeAnalysis.CSharp.SymbolDisplay"/>
#Enable Warning CA1200 ' Avoid using cref tags with a prefix
Public Module SymbolDisplay
''' <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,9 @@ private void InvokeWorker(
FunctionId.CodeFixes_ApplyChanges, KeyValueLogMessage.Create(LogType.UserAction, m => CreateLogProperties(m)), cancellationToken))
{
// Note: we want to block the UI thread here so the user cannot modify anything while the codefix applies
var applicationTask = EditHandler.ApplyAsync(Workspace, getFromDocument(),
_isApplied = EditHandler.Apply(Workspace, getFromDocument(),
operations.ToImmutableArray(), CodeAction.Title,
progressTracker, cancellationToken);
applicationTask.Wait(cancellationToken);
_isApplied = applicationTask.Result;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Editor.Undo;
Expand Down Expand Up @@ -94,7 +93,7 @@ public SolutionPreviewResult GetPreviews(
return currentResult;
}

public async Task<bool> ApplyAsync(
public bool Apply(
Workspace workspace, Document fromDocument,
ImmutableArray<CodeActionOperation> operations,
string title, IProgressTracker progressTracker,
Expand All @@ -121,9 +120,7 @@ public async Task<bool> ApplyAsync(
{
foreach (var document in project.Documents)
{
// ConfigureAwait(true) so we come back to the same thread as
// we do all application on the UI thread.
if (!await document.HasAnyErrorsAsync(cancellationToken).ConfigureAwait(true))
if (!document.HasAnyErrorsAsync(cancellationToken).WaitAndGetResult(cancellationToken))
{
documentErrorLookup.Add(document.Id);
}
Expand All @@ -147,9 +144,7 @@ public async Task<bool> ApplyAsync(
var singleChangedDocument = TryGetSingleChangedText(oldSolution, operations);
if (singleChangedDocument != null)
{
// ConfigureAwait(true) so we come back to the same thread as
// we do all application on the UI thread.
var text = await singleChangedDocument.GetTextAsync(cancellationToken).ConfigureAwait(true);
var text = singleChangedDocument.GetTextSynchronously(cancellationToken);

using (workspace.Services.GetService<ISourceTextUndoService>().RegisterUndoTransaction(text, title))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal interface ICodeActionEditHandlerService
SolutionPreviewResult GetPreviews(
Workspace workspace, ImmutableArray<CodeActionOperation> operations, CancellationToken cancellationToken);

Task<bool> ApplyAsync(
bool Apply(
Workspace workspace, Document fromDocument,
ImmutableArray<CodeActionOperation> operations,
string title, IProgressTracker progressTracker,
Expand Down
2 changes: 1 addition & 1 deletion src/EditorFeatures/Test2/Rename/InlineRenameTests.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ class C
Dim notificationService = DirectCast(workspace.Services.GetService(Of INotificationService)(), INotificationServiceCallback)
notificationService.NotificationCallback = Sub(message, title, severity) actualSeverity = severity

Await editHandler.ApplyAsync(
editHandler.Apply(
workspace,
workspace.CurrentSolution.GetDocument(workspace.Documents.Single().Id),
Await actions.First().NestedCodeActions.First().GetOperationsAsync(CancellationToken.None),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,13 @@ void applyFix(IWaitContext context)
{
var operations = ImmutableArray.Create<CodeActionOperation>(new ApplyChangesOperation(newSolution));
var cancellationToken = context.CancellationToken;
_editHandlerService.ApplyAsync(
_editHandlerService.Apply(
_workspace,
fromDocument: null,
operations: operations,
title: title,
progressTracker: context.ProgressTracker,
cancellationToken: cancellationToken).Wait(cancellationToken);
cancellationToken: cancellationToken);
}

result = InvokeWithWaitDialog(applyFix, title, waitDialogMessage);
Expand Down