提交 3b369f41 编写于 作者: D Dustin Campbell 提交者: GitHub

Merge pull request #15873 from CyrusNajmabadi/noFarProgress

Remove call to SetProgress for performance reasons.
......@@ -580,6 +580,12 @@ private RoslynDefinitionBucket GetOrCreateDefinitionBucket(DefinitionItem defini
public override Task ReportProgressAsync(int current, int maximum)
{
// https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=359162
// Right now VS actually responds to each SetProgess call by enqueueing a UI task
// to do the progress bar update. This can made FindReferences feel extremely slow
// when thousands of SetProgress calls are made. So, for now, we're removing
// the progress update until the FindRefs window fixes that perf issue.
#if false
try
{
// The original FAR window exposed a SetProgress(double). Ensure that we
......@@ -589,6 +595,7 @@ public override Task ReportProgressAsync(int current, int maximum)
catch
{
}
#endif
return SpecializedTasks.EmptyTask;
}
......
......@@ -87,6 +87,11 @@ protected Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IIm
PredefinedType predefinedType,
CancellationToken cancellationToken)
{
if (predefinedType == PredefinedType.None)
{
return SpecializedTasks.EmptyImmutableArray<Document>();
}
return FindDocumentsAsync(project, documents, async (d, c) =>
{
var info = await SyntaxTreeInfo.GetContextInfoAsync(d, c).ConfigureAwait(false);
......@@ -94,7 +99,7 @@ protected Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IIm
}, cancellationToken);
}
protected async Task<ImmutableArray<Document>> FindDocumentsAsync(
protected Task<ImmutableArray<Document>> FindDocumentsAsync(
Project project,
IImmutableSet<Document> documents,
PredefinedOperator op,
......@@ -102,14 +107,14 @@ protected Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IIm
{
if (op == PredefinedOperator.None)
{
return ImmutableArray<Document>.Empty;
return SpecializedTasks.EmptyImmutableArray<Document>();
}
return await FindDocumentsAsync(project, documents, async (d, c) =>
return FindDocumentsAsync(project, documents, async (d, c) =>
{
var info = await SyntaxTreeInfo.GetContextInfoAsync(d, c).ConfigureAwait(false);
return info.ContainsPredefinedOperator(op);
}, cancellationToken).ConfigureAwait(false);
}, cancellationToken);
}
protected static bool IdentifiersMatch(ISyntaxFactsService syntaxFacts, string name, SyntaxToken token)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册