提交 dd804e77 编写于 作者: C Cyrus Najmabadi

Make more tests async.

上级 0758c0c3
......@@ -504,8 +504,8 @@ NewLines("Imports System.Linq \n Class C \n Private v As Integer \n Sub New() \n
<WorkItem(6541, "https://github.com/dotnet/Roslyn/issues/6541")>
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Sub TestGenerateInDerivedType1()
Test(
Public Async Function TestGenerateInDerivedType1() As Task
Await TestAsync(
"
Public Class Base
Public Sub New(a As String)
......@@ -531,12 +531,12 @@ Public Class Derived
MyBase.New(a)
End Sub
End Class")
End Sub
End Function
<WorkItem(6541, "https://github.com/dotnet/Roslyn/issues/6541")>
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Sub TestGenerateInDerivedType2()
Test(
Public Async Function TestGenerateInDerivedType2() As Task
Await TestAsync(
"
Public Class Base
Public Sub New(a As Integer, Optional b As String = Nothing)
......@@ -562,6 +562,6 @@ Public Class Derived
MyBase.New(a, b)
End Sub
End Class")
End Sub
End Function
End Class
End Namespace
......@@ -218,7 +218,7 @@ public override SyntaxToken VisitToken(SyntaxToken token)
if (tokenNeedsConflictCheck)
{
newToken = RenameAndAnnotateAsync(token, newToken, isRenameLocation, isOldText).WaitAndGetResult(_cancellationToken);
newToken = RenameAndAnnotateAsync(token, newToken, isRenameLocation, isOldText).WaitAndGetResult_CanCallOnBackground(_cancellationToken);
if (!_isProcessingComplexifiedSpans)
{
......@@ -382,9 +382,8 @@ private async Task<SyntaxToken> RenameAndAnnotateAsync(SyntaxToken token, Syntax
AddModifiedSpan(oldSpan, newToken.Span);
}
RenameDeclarationLocationReference[] renameDeclarationLocations =
ConflictResolver.CreateDeclarationLocationAnnotationsAsync(_solution, symbols, _cancellationToken)
.WaitAndGetResult(_cancellationToken);
var renameDeclarationLocations = await
ConflictResolver.CreateDeclarationLocationAnnotationsAsync(_solution, symbols, _cancellationToken).ConfigureAwait(false);
var isNamespaceDeclarationReference = false;
if (isRenameLocation && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword))
......
......@@ -6,6 +6,7 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
......@@ -59,14 +60,14 @@ internal void UpdateCurrentSolution(Solution solution)
_newSolution = solution;
}
internal void RemoveAllRenameAnnotations(IEnumerable<DocumentId> documentWithRenameAnnotations, AnnotationTable<RenameAnnotation> annotationSet, CancellationToken cancellationToken)
internal async Task RemoveAllRenameAnnotationsAsync(IEnumerable<DocumentId> documentWithRenameAnnotations, AnnotationTable<RenameAnnotation> annotationSet, CancellationToken cancellationToken)
{
foreach (var documentId in documentWithRenameAnnotations)
{
if (_renamedSpansTracker.IsDocumentChanged(documentId))
{
var document = _newSolution.GetDocument(documentId);
var root = document.GetSyntaxRootAsync(cancellationToken).WaitAndGetResult(cancellationToken);
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
// For the computeReplacementToken and computeReplacementNode functions, use
// the "updated" node to maintain any annotation removals from descendants.
......
......@@ -199,7 +199,7 @@ public async Task<ConflictResolution> ResolveConflictsAsync()
// Step 3: Simplify the project
conflictResolution.UpdateCurrentSolution(await renamedSpansTracker.SimplifyAsync(conflictResolution.NewSolution, documentsByProject, _replacementTextValid, _renameAnnotations, _cancellationToken).ConfigureAwait(false));
conflictResolution.RemoveAllRenameAnnotations(documentsByProject, _renameAnnotations, _cancellationToken);
await conflictResolution.RemoveAllRenameAnnotationsAsync(documentsByProject, _renameAnnotations, _cancellationToken).ConfigureAwait(false);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册