Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
13e12415
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,发现更多精彩内容 >>
提交
13e12415
编写于
7月 24, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't add a NonNavigableItem unless we get no definition locations.
上级
fc51a0f8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
12 deletion
+30
-12
src/EditorFeatures/Core/Implementation/FindReferences/IDefinitionsAndReferencesFactory.cs
...tation/FindReferences/IDefinitionsAndReferencesFactory.cs
+29
-11
src/Workspaces/Core/Portable/Shared/Extensions/IFindReferencesResultExtensions.cs
...able/Shared/Extensions/IFindReferencesResultExtensions.cs
+1
-1
未找到文件。
src/EditorFeatures/Core/Implementation/FindReferences/IDefinitionsAndReferencesFactory.cs
浏览文件 @
13e12415
...
...
@@ -29,6 +29,9 @@ internal class DefaultDefinitionsAndReferencesFactory : IDefinitionsAndReference
var
definitions
=
ImmutableArray
.
CreateBuilder
<
DefinitionItem
>();
var
references
=
ImmutableArray
.
CreateBuilder
<
SourceReferenceItem
>();
// Order the symbols by precedence, then create the appropriate
// definition item per symbol and all refernece items for its
// reference locations.
foreach
(
var
referencedSymbol
in
referencedSymbols
.
OrderBy
(
GetPrecedence
))
{
ProcessReferencedSymbol
(
solution
,
referencedSymbol
,
definitions
,
references
);
...
...
@@ -78,11 +81,15 @@ private static int GetPrecedence(ReferencedSymbol referencedSymbol)
ImmutableArray
<
DefinitionItem
>.
Builder
definitions
,
ImmutableArray
<
SourceReferenceItem
>.
Builder
references
)
{
// See if this is a symbol we even want to present to the user. If not,
// ignore it entirely (including all its reference locations).
if
(!
referencedSymbol
.
ShouldShow
())
{
return
;
}
// Try to create an item for this definition. If we can't,
// ignorei it entirely (including all its reference locations).
var
definitionItem
=
CreateDefinitionItem
(
solution
,
referencedSymbol
);
if
(
definitionItem
==
null
)
{
...
...
@@ -90,8 +97,13 @@ private static int GetPrecedence(ReferencedSymbol referencedSymbol)
}
definitions
.
Add
(
definitionItem
);
// Now, create the SourceReferenceItems for all the reference locations
// for this definition.
CreateReferences
(
referencedSymbol
,
references
,
definitionItem
);
// Finally, see if there are any third parties that want to add their
// own result to our collection.
var
thirdPartyItem
=
GetThirdPartyDefinitionItem
(
solution
,
referencedSymbol
.
Definition
);
if
(
thirdPartyItem
!=
null
)
{
...
...
@@ -114,13 +126,16 @@ private static int GetPrecedence(ReferencedSymbol referencedSymbol)
{
var
definition
=
referencedSymbol
.
Definition
;
var
locations
=
FilterDefinitionLocations
(
definition
);
var
definitionLocations
=
ConvertLocations
(
solution
,
referencedSymbol
,
locations
);
if
(
definitionLocations
.
IsEmpty
)
{
return
null
;
}
// First, determine the set of locations for this symbol that we'll
// want to present to the user. Some symbols (like namespace) may
// have many locations, but we'll only want to show the user a single
// one.
var
filteredLocations
=
FilterDefinitionLocations
(
definition
);
// Convert the filtered set of locations to DefinitionLocation instances.
// If weren't any to, say because the symbol had no locations that we
// could understand (like Location.None), then we skip this item.
var
definitionLocations
=
ConvertLocations
(
solution
,
referencedSymbol
,
filteredLocations
);
var
displayParts
=
definition
.
ToDisplayParts
(
s_definitionDisplayFormat
).
ToTaggedText
();
return
new
DefinitionItem
(
...
...
@@ -146,11 +161,6 @@ private static int GetPrecedence(ReferencedSymbol referencedSymbol)
result
.
Add
(
DefinitionLocation
.
CreateSymbolLocation
(
definition
,
firstSourceReferenceLocation
.
Document
.
Project
));
}
else
{
result
.
Add
(
DefinitionLocation
.
CreateNonNavigatingLocation
(
DefinitionLocation
.
GetOriginationParts
(
definition
)));
}
}
else
if
(
location
.
IsInSource
)
{
...
...
@@ -166,6 +176,14 @@ private static int GetPrecedence(ReferencedSymbol referencedSymbol)
}
}
if
(
result
.
Count
==
0
)
{
// If we got no definition locations, then create a sentinel one
// that we can display but which will not allow navigation.
result
.
Add
(
DefinitionLocation
.
CreateNonNavigatingLocation
(
DefinitionLocation
.
GetOriginationParts
(
definition
)));
}
return
result
.
ToImmutable
();
}
...
...
src/Workspaces/Core/Portable/Shared/Extensions/IFindReferencesResultExtensions.cs
浏览文件 @
13e12415
...
...
@@ -20,7 +20,7 @@ internal static partial class IFindReferencesResultExtensions
public
static
bool
ShouldShow
(
this
ReferencedSymbol
referencedSymbol
)
{
// If the reference has any locations then we will present it.
if
(
referencedSymbol
.
Locations
.
Any
(
loc
=>
loc
.
Location
.
IsInSource
))
if
(
referencedSymbol
.
Locations
.
Any
())
{
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录