Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
0b160c3a
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,发现更多精彩内容 >>
提交
0b160c3a
编写于
4月 24, 2017
作者:
C
CyrusNajmabadi
提交者:
GitHub
4月 24, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18927 from CyrusNajmabadi/asyncContext
Make all of FindUsagesContext async.
上级
76fbcf63
3535114e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
22 deletion
+29
-22
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
...itorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
+9
-8
src/EditorFeatures/Core/FindUsages/FindUsagesContext.cs
src/EditorFeatures/Core/FindUsages/FindUsagesContext.cs
+2
-6
src/EditorFeatures/Core/FindUsages/IFindUsagesContext.cs
src/EditorFeatures/Core/FindUsages/IFindUsagesContext.cs
+2
-2
src/EditorFeatures/Core/FindUsages/SimpleFindUsagesContext.cs
...EditorFeatures/Core/FindUsages/SimpleFindUsagesContext.cs
+10
-4
src/VisualStudio/Core/Next/FindReferences/Contexts/AbstractTableDataSourceFindUsagesContext.cs
...nces/Contexts/AbstractTableDataSourceFindUsagesContext.cs
+6
-2
未找到文件。
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
浏览文件 @
0b160c3a
...
...
@@ -22,7 +22,8 @@ internal abstract partial class AbstractFindUsagesService : IFindUsagesService
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
tuple
==
null
)
{
context
.
ReportMessage
(
EditorFeaturesResources
.
Cannot_navigate_to_the_symbol_under_the_caret
);
await
context
.
ReportMessageAsync
(
EditorFeaturesResources
.
Cannot_navigate_to_the_symbol_under_the_caret
).
ConfigureAwait
(
false
);
return
;
}
...
...
@@ -30,12 +31,13 @@ internal abstract partial class AbstractFindUsagesService : IFindUsagesService
if
(
message
!=
null
)
{
context
.
ReportMessage
(
messag
e
);
await
context
.
ReportMessageAsync
(
message
).
ConfigureAwait
(
fals
e
);
return
;
}
context
.
SetSearchTitle
(
string
.
Format
(
EditorFeaturesResources
.
_0_implementations
,
FindUsagesHelpers
.
GetDisplayName
(
tuple
.
Value
.
symbol
)));
await
context
.
SetSearchTitleAsync
(
string
.
Format
(
EditorFeaturesResources
.
_0_implementations
,
FindUsagesHelpers
.
GetDisplayName
(
tuple
.
Value
.
symbol
))).
ConfigureAwait
(
false
);
var
project
=
tuple
.
Value
.
project
;
foreach
(
var
implementation
in
tuple
.
Value
.
implementations
)
...
...
@@ -127,9 +129,8 @@ internal abstract partial class AbstractFindUsagesService : IFindUsagesService
public
static
async
Task
FindSymbolReferencesAsync
(
IFindUsagesContext
context
,
ISymbol
symbol
,
Project
project
,
CancellationToken
cancellationToken
)
{
context
.
SetSearchTitle
(
string
.
Format
(
EditorFeaturesResources
.
_0_references
,
FindUsagesHelpers
.
GetDisplayName
(
symbol
)));
await
context
.
SetSearchTitleAsync
(
string
.
Format
(
EditorFeaturesResources
.
_0_references
,
FindUsagesHelpers
.
GetDisplayName
(
symbol
))).
ConfigureAwait
(
false
);
var
progressAdapter
=
new
FindReferencesProgressAdapter
(
project
.
Solution
,
context
);
// Now call into the underlying FAR engine to find reference. The FAR
...
...
@@ -195,7 +196,7 @@ internal abstract partial class AbstractFindUsagesService : IFindUsagesService
}
var
searchTitle
=
string
.
Format
(
EditorFeaturesResources
.
_0_references
,
title
);
context
.
SetSearchTitle
(
searchTitl
e
);
await
context
.
SetSearchTitleAsync
(
searchTitle
).
ConfigureAwait
(
fals
e
);
var
solution
=
document
.
Project
.
Solution
;
...
...
src/EditorFeatures/Core/FindUsages/FindUsagesContext.cs
浏览文件 @
0b160c3a
...
...
@@ -15,13 +15,9 @@ protected FindUsagesContext()
{
}
public
virtual
void
ReportMessage
(
string
message
)
{
}
public
virtual
Task
ReportMessageAsync
(
string
message
)
=>
SpecializedTasks
.
EmptyTask
;
public
virtual
void
SetSearchTitle
(
string
title
)
{
}
public
virtual
Task
SetSearchTitleAsync
(
string
title
)
=>
SpecializedTasks
.
EmptyTask
;
public
virtual
Task
OnCompletedAsync
()
=>
SpecializedTasks
.
EmptyTask
;
...
...
src/EditorFeatures/Core/FindUsages/IFindUsagesContext.cs
浏览文件 @
0b160c3a
...
...
@@ -12,12 +12,12 @@ internal interface IFindUsagesContext
/// <summary>
/// Report a message to be displayed to the user.
/// </summary>
void
ReportMessage
(
string
message
);
Task
ReportMessageAsync
(
string
message
);
/// <summary>
/// Set the title of the window that results are displayed in.
/// </summary>
void
SetSearchTitle
(
string
title
);
Task
SetSearchTitleAsync
(
string
title
);
Task
OnDefinitionFoundAsync
(
DefinitionItem
definition
);
Task
OnReferenceFoundAsync
(
SourceReferenceItem
reference
);
...
...
src/EditorFeatures/Core/FindUsages/SimpleFindUsagesContext.cs
浏览文件 @
0b160c3a
...
...
@@ -31,11 +31,17 @@ public SimpleFindUsagesContext(CancellationToken cancellationToken)
public
string
Message
{
get
;
private
set
;
}
public
string
SearchTitle
{
get
;
private
set
;
}
public
override
void
ReportMessage
(
string
message
)
=>
Message
=
message
;
public
override
Task
ReportMessageAsync
(
string
message
)
{
Message
=
message
;
return
SpecializedTasks
.
EmptyTask
;
}
public
override
void
SetSearchTitle
(
string
title
)
=>
SearchTitle
=
title
;
public
override
Task
SetSearchTitleAsync
(
string
title
)
{
SearchTitle
=
title
;
return
SpecializedTasks
.
EmptyTask
;
}
public
ImmutableArray
<
DefinitionItem
>
GetDefinitions
()
{
...
...
src/VisualStudio/Core/Next/FindReferences/Contexts/AbstractTableDataSourceFindUsagesContext.cs
浏览文件 @
0b160c3a
...
...
@@ -218,8 +218,12 @@ public IDisposable Subscribe(ITableDataSink sink)
#
region
FindUsagesContext
overrides
.
public
sealed
override
void
SetSearchTitle
(
string
title
)
=>
_findReferencesWindow
.
Title
=
title
;
public
sealed
override
Task
SetSearchTitleAsync
(
string
title
)
{
// Note: IFindAllReferenceWindow.Title is safe to set from any thread.
_findReferencesWindow
.
Title
=
title
;
return
SpecializedTasks
.
EmptyTask
;
}
public
sealed
override
async
Task
OnCompletedAsync
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录