Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a416a123
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,发现更多精彩内容 >>
提交
a416a123
编写于
4月 18, 2020
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix
上级
284db945
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
30 deletion
+23
-30
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
...itorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
+5
-8
src/EditorFeatures/Core/FindUsages/FindUsagesHelpers.cs
src/EditorFeatures/Core/FindUsages/FindUsagesHelpers.cs
+11
-9
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
+7
-13
未找到文件。
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
浏览文件 @
a416a123
...
@@ -38,7 +38,7 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
...
@@ -38,7 +38,7 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
return
;
return
;
}
}
var
(
symbolAndProjectId
,
implementations
,
message
)
=
tupleOpt
.
Value
;
var
(
s
olution
,
s
ymbolAndProjectId
,
implementations
,
message
)
=
tupleOpt
.
Value
;
if
(
message
!=
null
)
if
(
message
!=
null
)
{
{
await
context
.
ReportMessageAsync
(
message
).
ConfigureAwait
(
false
);
await
context
.
ReportMessageAsync
(
message
).
ConfigureAwait
(
false
);
...
@@ -49,7 +49,6 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
...
@@ -49,7 +49,6 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
string
.
Format
(
EditorFeaturesResources
.
_0_implementations
,
string
.
Format
(
EditorFeaturesResources
.
_0_implementations
,
FindUsagesHelpers
.
GetDisplayName
(
symbolAndProjectId
.
Symbol
))).
ConfigureAwait
(
false
);
FindUsagesHelpers
.
GetDisplayName
(
symbolAndProjectId
.
Symbol
))).
ConfigureAwait
(
false
);
var
solution
=
document
.
Project
.
Solution
;
foreach
(
var
implementation
in
implementations
)
foreach
(
var
implementation
in
implementations
)
{
{
var
definitionItem
=
await
implementation
.
Symbol
.
ToClassifiedDefinitionItemAsync
(
var
definitionItem
=
await
implementation
.
Symbol
.
ToClassifiedDefinitionItemAsync
(
...
@@ -122,18 +121,16 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
...
@@ -122,18 +121,16 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
cancellationToken
.
ThrowIfCancellationRequested
();
cancellationToken
.
ThrowIfCancellationRequested
();
// Find the symbol we want to search and the solution we want to search in.
// Find the symbol we want to search and the solution we want to search in.
var
symbolAndProject
IdOpt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndProjectId
AtPositionAsync
(
var
symbolAndProject
Opt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndProject
AtPositionAsync
(
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
symbolAndProject
Id
Opt
==
null
)
if
(
symbolAndProjectOpt
==
null
)
return
;
return
;
var
solution
=
document
.
Project
.
Solution
;
var
(
symbol
,
project
)
=
symbolAndProjectOpt
.
Value
;
var
symbolAndProjectId
=
symbolAndProjectIdOpt
.
Value
;
await
FindSymbolReferencesAsync
(
await
FindSymbolReferencesAsync
(
_threadingContext
,
context
,
_threadingContext
,
context
,
symbolAndProjectId
.
Symbol
,
symbol
,
project
,
solution
.
GetRequiredProject
(
symbolAndProjectId
.
ProjectId
),
cancellationToken
).
ConfigureAwait
(
false
);
cancellationToken
).
ConfigureAwait
(
false
);
}
}
...
...
src/EditorFeatures/Core/FindUsages/FindUsagesHelpers.cs
浏览文件 @
a416a123
...
@@ -31,7 +31,7 @@ public static string GetDisplayName(ISymbol symbol)
...
@@ -31,7 +31,7 @@ public static string GetDisplayName(ISymbol symbol)
/// there may be symbol mapping involved (for example in Metadata-As-Source
/// there may be symbol mapping involved (for example in Metadata-As-Source
/// scenarios).
/// scenarios).
/// </summary>
/// </summary>
public
static
async
Task
<
SymbolAndProjectId
?>
GetRelevantSymbolAndProjectId
AtPositionAsync
(
public
static
async
Task
<
(
ISymbol
symbol
,
Project
project
)?>
GetRelevantSymbolAndProject
AtPositionAsync
(
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
{
{
cancellationToken
.
ThrowIfCancellationRequested
();
cancellationToken
.
ThrowIfCancellationRequested
();
...
@@ -49,21 +49,23 @@ public static string GetDisplayName(ISymbol symbol)
...
@@ -49,21 +49,23 @@ public static string GetDisplayName(ISymbol symbol)
if
(
mapping
==
null
)
if
(
mapping
==
null
)
return
null
;
return
null
;
return
new
SymbolAndProjectId
(
mapping
.
Symbol
,
mapping
.
Project
.
Id
);
return
(
mapping
.
Symbol
,
mapping
.
Project
);
}
}
public
static
async
Task
<(
SymbolAndProjectId
symboAndProjectId
,
ImmutableArray
<
SymbolAndProjectId
>
implementations
,
string
message
)?>
FindSourceImplementationsAsync
(
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
public
static
async
Task
<(
S
olution
solution
,
S
ymbolAndProjectId
symboAndProjectId
,
ImmutableArray
<
SymbolAndProjectId
>
implementations
,
string
message
)?>
FindSourceImplementationsAsync
(
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
{
{
var
symbolAndProject
IdOpt
=
await
GetRelevantSymbolAndProjectId
AtPositionAsync
(
var
symbolAndProject
Opt
=
await
GetRelevantSymbolAndProject
AtPositionAsync
(
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
symbolAndProject
Id
Opt
==
null
)
if
(
symbolAndProjectOpt
==
null
)
return
null
;
return
null
;
var
(
symbol
,
project
)
=
symbolAndProjectOpt
.
Value
;
var
symbolAndProjectId
=
new
SymbolAndProjectId
(
symbol
,
project
.
Id
);
return
await
FindSourceImplementationsAsync
(
return
await
FindSourceImplementationsAsync
(
symbolAndProjectId
Opt
.
Value
,
document
.
P
roject
.
Solution
,
cancellationToken
).
ConfigureAwait
(
false
);
symbolAndProjectId
,
p
roject
.
Solution
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
private
static
async
Task
<(
SymbolAndProjectId
symbolAndProjectId
,
ImmutableArray
<
SymbolAndProjectId
>
implementations
,
string
message
)?>
FindSourceImplementationsAsync
(
private
static
async
Task
<(
S
olution
solution
,
S
ymbolAndProjectId
symbolAndProjectId
,
ImmutableArray
<
SymbolAndProjectId
>
implementations
,
string
message
)?>
FindSourceImplementationsAsync
(
SymbolAndProjectId
symbolAndProjectId
,
Solution
solution
,
CancellationToken
cancellationToken
)
SymbolAndProjectId
symbolAndProjectId
,
Solution
solution
,
CancellationToken
cancellationToken
)
{
{
var
builder
=
new
HashSet
<
SymbolAndProjectId
>(
SymbolAndProjectIdComparer
.
SymbolEquivalenceInstance
);
var
builder
=
new
HashSet
<
SymbolAndProjectId
>(
SymbolAndProjectIdComparer
.
SymbolEquivalenceInstance
);
...
@@ -86,8 +88,8 @@ public static async Task<(SymbolAndProjectId symboAndProjectId, ImmutableArray<S
...
@@ -86,8 +88,8 @@ public static async Task<(SymbolAndProjectId symboAndProjectId, ImmutableArray<S
var
result
=
builder
.
ToImmutableArray
();
var
result
=
builder
.
ToImmutableArray
();
return
result
.
Length
==
0
return
result
.
Length
==
0
?
(
symbolAndProjectId
,
result
,
EditorFeaturesResources
.
The_symbol_has_no_implementations
)
?
(
s
olution
,
s
ymbolAndProjectId
,
result
,
EditorFeaturesResources
.
The_symbol_has_no_implementations
)
:
(
symbolAndProjectId
,
result
,
null
);
:
(
s
olution
,
s
ymbolAndProjectId
,
result
,
null
);
}
}
private
static
async
Task
<
ImmutableArray
<
SymbolAndProjectId
>>
FindSourceImplementationsWorkerAsync
(
private
static
async
Task
<
ImmutableArray
<
SymbolAndProjectId
>>
FindSourceImplementationsWorkerAsync
(
...
...
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
浏览文件 @
a416a123
...
@@ -16,30 +16,24 @@ internal abstract partial class AbstractGoToBaseService : IGoToBaseService
...
@@ -16,30 +16,24 @@ internal abstract partial class AbstractGoToBaseService : IGoToBaseService
public
async
Task
FindBasesAsync
(
Document
document
,
int
position
,
IFindUsagesContext
context
)
public
async
Task
FindBasesAsync
(
Document
document
,
int
position
,
IFindUsagesContext
context
)
{
{
var
cancellationToken
=
context
.
CancellationToken
;
var
cancellationToken
=
context
.
CancellationToken
;
var
symbolAndProject
IdOpt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndProjectId
AtPositionAsync
(
var
symbolAndProject
Opt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndProject
AtPositionAsync
(
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
symbolAndProject
Id
Opt
==
null
)
if
(
symbolAndProjectOpt
==
null
)
{
{
await
context
.
ReportMessageAsync
(
await
context
.
ReportMessageAsync
(
EditorFeaturesResources
.
Cannot_navigate_to_the_symbol_under_the_caret
).
ConfigureAwait
(
false
);
EditorFeaturesResources
.
Cannot_navigate_to_the_symbol_under_the_caret
).
ConfigureAwait
(
false
);
return
;
return
;
}
}
var
solution
=
document
.
Project
.
Solution
;
var
(
symbol
,
project
)
=
symbolAndProjectOpt
.
Value
;
var
symbolAndProjectId
=
symbolAndProjectIdOpt
.
Value
;
var
bases
=
FindBaseHelpers
.
FindBases
(
var
bases
=
FindBaseHelpers
.
FindBases
(
symbolAndProjectId
.
Symbol
,
symbol
,
project
,
cancellationToken
);
solution
.
GetRequiredProject
(
symbolAndProjectId
.
ProjectId
),
cancellationToken
);
await
context
.
SetSearchTitleAsync
(
await
context
.
SetSearchTitleAsync
(
string
.
Format
(
EditorFeaturesResources
.
_0_bases
,
string
.
Format
(
EditorFeaturesResources
.
_0_bases
,
FindUsagesHelpers
.
GetDisplayName
(
symbolAndProjectId
.
Symbol
))).
ConfigureAwait
(
false
);
FindUsagesHelpers
.
GetDisplayName
(
symbol
))).
ConfigureAwait
(
false
);
var
project
=
document
.
Project
;
var
projectId
=
project
.
Id
;
var
found
=
false
;
var
found
=
false
;
...
@@ -49,11 +43,11 @@ public async Task FindBasesAsync(Document document, int position, IFindUsagesCon
...
@@ -49,11 +43,11 @@ public async Task FindBasesAsync(Document document, int position, IFindUsagesCon
foreach
(
var
baseSymbol
in
bases
)
foreach
(
var
baseSymbol
in
bases
)
{
{
var
sourceDefinition
=
await
SymbolFinder
.
FindSourceDefinitionAsync
(
var
sourceDefinition
=
await
SymbolFinder
.
FindSourceDefinitionAsync
(
SymbolAndProjectId
.
Create
(
baseSymbol
,
project
Id
),
s
olution
,
cancellationToken
).
ConfigureAwait
(
false
);
SymbolAndProjectId
.
Create
(
baseSymbol
,
project
.
Id
),
project
.
S
olution
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
sourceDefinition
.
Symbol
!=
null
)
if
(
sourceDefinition
.
Symbol
!=
null
)
{
{
var
definitionItem
=
await
sourceDefinition
.
Symbol
.
ToClassifiedDefinitionItemAsync
(
var
definitionItem
=
await
sourceDefinition
.
Symbol
.
ToClassifiedDefinitionItemAsync
(
s
olution
.
GetProject
(
sourceDefinition
.
ProjectId
),
includeHiddenLocations
:
false
,
project
.
S
olution
.
GetProject
(
sourceDefinition
.
ProjectId
),
includeHiddenLocations
:
false
,
FindReferencesSearchOptions
.
Default
,
cancellationToken
:
cancellationToken
)
FindReferencesSearchOptions
.
Default
,
cancellationToken
:
cancellationToken
)
.
ConfigureAwait
(
false
);
.
ConfigureAwait
(
false
);
await
context
.
OnDefinitionFoundAsync
(
definitionItem
).
ConfigureAwait
(
false
);
await
context
.
OnDefinitionFoundAsync
(
definitionItem
).
ConfigureAwait
(
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录