Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
7e5ac018
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7e5ac018
编写于
4月 03, 2020
作者:
C
CyrusNajmabadi
提交者:
GitHub
4月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #42430 from CyrusNajmabadi/findRefsProgress
Re-enable find-references progress.
上级
3b726599
533f6f16
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
13 deletion
+24
-13
src/VisualStudio/Core/Def/Implementation/FindReferences/Contexts/AbstractTableDataSourceFindUsagesContext.cs
...nces/Contexts/AbstractTableDataSourceFindUsagesContext.cs
+24
-13
未找到文件。
src/VisualStudio/Core/Def/Implementation/FindReferences/Contexts/AbstractTableDataSourceFindUsagesContext.cs
浏览文件 @
7e5ac018
...
...
@@ -6,6 +6,7 @@
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis
;
...
...
@@ -19,6 +20,7 @@
using
Microsoft.VisualStudio.Shell.FindAllReferences
;
using
Microsoft.VisualStudio.Shell.TableControl
;
using
Microsoft.VisualStudio.Shell.TableManager
;
using
Roslyn.Utilities
;
namespace
Microsoft.VisualStudio.LanguageServices.FindUsages
{
...
...
@@ -35,6 +37,8 @@ private abstract class AbstractTableDataSourceFindUsagesContext :
private
readonly
IFindAllReferencesWindow
_findReferencesWindow
;
protected
readonly
IWpfTableControl2
TableControl
;
private
readonly
AsyncBatchingWorkQueue
<(
int
current
,
int
maximum
)>
_progressQueue
;
protected
readonly
object
Gate
=
new
object
();
#
region
Fields
that
should
be
locked
by
_gate
...
...
@@ -111,6 +115,18 @@ private abstract class AbstractTableDataSourceFindUsagesContext :
// After adding us as the source, the manager should immediately call into us to
// tell us what the data sink is.
Debug
.
Assert
(
_tableDataSink
!=
null
);
// https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=359162
// 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.
//
// To ensure a reasonable experience, we instead add the progress into a queue and
// only update the UI a few times a second so as to not overload it.
_progressQueue
=
new
AsyncBatchingWorkQueue
<(
int
current
,
int
maximum
)>(
TimeSpan
.
FromMilliseconds
(
250
),
this
.
UpdateTableProgressAsync
,
this
.
CancellationToken
);
}
private
static
ImmutableArray
<
string
>
SelectCustomColumnsToInclude
(
ImmutableArray
<
ITableColumnDefinition
>
customColumns
,
bool
includeContainingTypeAndMemberColumns
,
bool
includeKindColumn
)
...
...
@@ -379,22 +395,17 @@ public sealed override Task ReportMessageAsync(string message)
protected
sealed
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
_progressQueue
.
AddWork
((
current
,
maximum
));
return
Task
.
CompletedTask
;
}
private
Task
UpdateTableProgressAsync
(
ImmutableArray
<(
int
current
,
int
maximum
)>
nextBatch
,
CancellationToken
cancellationToken
)
{
if
(!
nextBatch
.
IsEmpty
)
{
// The original FAR window exposed a SetProgress(double). Ensure that we
// don't crash if this code is running on a machine without the new API.
var
(
current
,
maximum
)
=
nextBatch
.
Last
();
_findReferencesWindow
.
SetProgress
(
current
,
maximum
);
}
catch
{
}
#endif
return
Task
.
CompletedTask
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录