Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
135744e7
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,发现更多精彩内容 >>
未验证
提交
135744e7
编写于
10月 21, 2019
作者:
I
Ivan Basov
提交者:
GitHub
10月 21, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow up for Go to base: support metadata references and bug fixes (#39334)
上级
ecd5901a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
32 deletion
+31
-32
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
+3
-4
src/EditorFeatures/Test2/GoToBase/VisuaBasicGoToBaseTests.vb
src/EditorFeatures/Test2/GoToBase/VisuaBasicGoToBaseTests.vb
+1
-1
src/EditorFeatures/Test2/GoToHelpers/GoToHelpers.vb
src/EditorFeatures/Test2/GoToHelpers/GoToHelpers.vb
+8
-16
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/AbstractItemEntry.cs
...mplementation/FindReferences/Entries/AbstractItemEntry.cs
+3
-3
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DefinitionItemEntry.cs
...lementation/FindReferences/Entries/DefinitionItemEntry.cs
+1
-1
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DocumentSpanEntry.cs
...mplementation/FindReferences/Entries/DocumentSpanEntry.cs
+5
-5
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/MetadataDefinitionItemEntry.cs
...ion/FindReferences/Entries/MetadataDefinitionItemEntry.cs
+2
-2
src/Workspaces/Core/Portable/FindSymbols/FindReferences/BaseTypeFinder.cs
...ore/Portable/FindSymbols/FindReferences/BaseTypeFinder.cs
+8
-0
未找到文件。
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
浏览文件 @
135744e7
...
...
@@ -38,14 +38,13 @@ public async Task FindBasesAsync(Document document, int position, IFindUsagesCon
var
found
=
false
;
// For each potential base, try to find its definition in sources.
// If found, add it
s'
definitionItem to the context.
// If not found but the symbol is from metadata, create it
s'
definition item from metadata and add to the context.
// If found, add it
's
definitionItem to the context.
// If not found but the symbol is from metadata, create it
's
definition item from metadata and add to the context.
foreach
(
var
baseSymbol
in
bases
)
{
var
sourceDefinition
=
await
SymbolFinder
.
FindSourceDefinitionAsync
(
SymbolAndProjectId
.
Create
(
baseSymbol
,
projectId
),
solution
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
sourceDefinition
.
Symbol
!=
null
&&
sourceDefinition
.
Symbol
.
Locations
.
Any
(
l
=>
l
.
IsInSource
))
if
(
sourceDefinition
.
Symbol
!=
null
)
{
var
definitionItem
=
await
sourceDefinition
.
Symbol
.
ToClassifiedDefinitionItemAsync
(
solution
.
GetProject
(
sourceDefinition
.
ProjectId
),
includeHiddenLocations
:
false
,
...
...
src/EditorFeatures/Test2/GoToBase/VisuaBasicGoToBaseTests.vb
浏览文件 @
135744e7
...
...
@@ -420,7 +420,7 @@ End Interface")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
GoToBase
)
>
Public
Async
Function
TestWithVirtualMethodHiddenAndInterfaceImplementedOnDerivedType
()
As
Task
' We should not find hidden methods.
' We should not find methods of interfaces no implemented by the method symbol.
' We should not find methods of interfaces no
t
implemented by the method symbol.
' In this example,
' Dim i As I = New D()
' i.M()
...
...
src/EditorFeatures/Test2/GoToHelpers/GoToHelpers.vb
浏览文件 @
135744e7
...
...
@@ -45,13 +45,13 @@ Friend Class GoToHelpers
$
"Expected: ({expected}) but got: ({actual})"
)
Next
Dim
actualDefintionsWithoutSpans
=
context
.
GetDefinitions
()
.
Where
(
Function
(
d
)
d
.
SourceSpans
.
IsDefaultOrEmpty
).
Select
(
Function
(
di
)
Return
String
.
Format
(
"{0}:{1}"
,
String
.
Join
(
""
,
di
.
OriginationParts
.
Select
(
Function
(
t
)
t
.
Text
)),
String
.
Join
(
""
,
di
.
NameDisplayParts
.
Select
(
Function
(
t
)
t
.
Text
)))
End
Function
).
ToList
()
Dim
actualDefintionsWithoutSpans
=
context
.
GetDefinitions
()
_
.
Where
(
Function
(
d
)
d
.
SourceSpans
.
IsDefaultOrEmpty
)
_
.
Select
(
Function
(
di
)
Return
String
.
Format
(
"{0}:{1}"
,
String
.
Join
(
""
,
di
.
OriginationParts
.
Select
(
Function
(
t
)
t
.
Text
)),
String
.
Join
(
""
,
di
.
NameDisplayParts
.
Select
(
Function
(
t
)
t
.
Text
)))
End
Function
).
ToList
()
actualDefintionsWithoutSpans
.
Sort
()
...
...
@@ -59,15 +59,7 @@ Friend Class GoToHelpers
metadataDefinitions
=
{}
End
If
Assert
.
Equal
(
actualDefintionsWithoutSpans
.
Count
,
metadataDefinitions
.
Count
)
For
i
=
0
To
actualDefintionsWithoutSpans
.
Count
-
1
Dim
actual
=
actualDefintionsWithoutSpans
(
i
)
Dim
expected
=
metadataDefinitions
(
i
)
Assert
.
True
(
actual
.
CompareTo
(
expected
)
=
0
,
$
"Expected: ({expected}) but got: ({actual})"
)
Next
Assert
.
Equal
(
actualDefintionsWithoutSpans
,
metadataDefinitions
)
End
If
End
Using
End
Function
...
...
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/AbstractItemEntry.cs
浏览文件 @
135744e7
...
...
@@ -12,12 +12,12 @@ internal partial class StreamingFindUsagesPresenter
{
private
abstract
class
AbstractItemEntry
:
Entry
{
protected
readonly
StreamingFindUsagesPresenter
_p
resenter
;
protected
readonly
StreamingFindUsagesPresenter
P
resenter
;
public
AbstractItemEntry
(
RoslynDefinitionBucket
definitionBucket
,
StreamingFindUsagesPresenter
presenter
)
:
base
(
definitionBucket
)
{
_p
resenter
=
presenter
;
P
resenter
=
presenter
;
}
public
override
bool
TryCreateColumnContent
(
string
columnName
,
out
FrameworkElement
content
)
...
...
@@ -25,7 +25,7 @@ public override bool TryCreateColumnContent(string columnName, out FrameworkElem
if
(
columnName
==
StandardTableColumnDefinitions2
.
LineText
)
{
var
inlines
=
CreateLineTextInlines
();
var
textBlock
=
inlines
.
ToTextBlock
(
_p
resenter
.
ClassificationFormatMap
,
wrap
:
false
);
var
textBlock
=
inlines
.
ToTextBlock
(
P
resenter
.
ClassificationFormatMap
,
wrap
:
false
);
content
=
textBlock
;
return
true
;
...
...
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DefinitionItemEntry.cs
浏览文件 @
135744e7
...
...
@@ -30,7 +30,7 @@ private class DefinitionItemEntry : AbstractDocumentSpanEntry
}
protected
override
IList
<
Inline
>
CreateLineTextInlines
()
=>
DefinitionBucket
.
DefinitionItem
.
DisplayParts
.
ToInlines
(
_presenter
.
ClassificationFormatMap
,
_p
resenter
.
TypeMap
);
=>
DefinitionBucket
.
DefinitionItem
.
DisplayParts
.
ToInlines
(
Presenter
.
ClassificationFormatMap
,
P
resenter
.
TypeMap
);
}
}
}
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/DocumentSpanEntry.cs
浏览文件 @
135744e7
...
...
@@ -69,7 +69,7 @@ protected override IList<System.Windows.Documents.Inline> CreateLineTextInlines(
?
WrittenReferenceHighlightTag
.
TagId
:
ReferenceHighlightTag
.
TagId
;
var
properties
=
_p
resenter
.
FormatMapService
var
properties
=
P
resenter
.
FormatMapService
.
GetEditorFormatMap
(
"text"
)
.
GetProperties
(
propertyId
);
...
...
@@ -83,8 +83,8 @@ protected override IList<System.Windows.Documents.Inline> CreateLineTextInlines(
cs
=>
new
ClassifiedText
(
cs
.
ClassificationType
,
_excerptResult
.
Content
.
ToString
(
cs
.
TextSpan
)));
var
inlines
=
classifiedTexts
.
ToInlines
(
_p
resenter
.
ClassificationFormatMap
,
_p
resenter
.
TypeMap
,
P
resenter
.
ClassificationFormatMap
,
P
resenter
.
TypeMap
,
runCallback
:
(
run
,
classifiedText
,
position
)
=>
{
if
(
properties
[
"Background"
]
is
Brush
highlightBrush
)
...
...
@@ -136,7 +136,7 @@ protected override object GetValueWorker(string keyName)
private
DisposableToolTip
CreateDisposableToolTip
(
Document
document
,
TextSpan
sourceSpan
)
{
_p
resenter
.
AssertIsForeground
();
P
resenter
.
AssertIsForeground
();
var
controlService
=
document
.
Project
.
Solution
.
Workspace
.
Services
.
GetService
<
IContentControlService
>();
var
sourceText
=
document
.
GetTextSynchronously
(
CancellationToken
.
None
);
...
...
@@ -144,7 +144,7 @@ private DisposableToolTip CreateDisposableToolTip(Document document, TextSpan so
var
excerptService
=
document
.
Services
.
GetService
<
IDocumentExcerptService
>();
if
(
excerptService
!=
null
)
{
var
excerpt
=
_p
resenter
.
ThreadingContext
.
JoinableTaskFactory
.
Run
(()
=>
excerptService
.
TryExcerptAsync
(
document
,
sourceSpan
,
ExcerptMode
.
Tooltip
,
CancellationToken
.
None
));
var
excerpt
=
P
resenter
.
ThreadingContext
.
JoinableTaskFactory
.
Run
(()
=>
excerptService
.
TryExcerptAsync
(
document
,
sourceSpan
,
ExcerptMode
.
Tooltip
,
CancellationToken
.
None
));
if
(
excerpt
!=
null
)
{
// get tooltip from excerpt service
...
...
src/VisualStudio/Core/Def/Implementation/FindReferences/Entries/MetadataDefinitionItemEntry.cs
浏览文件 @
135744e7
...
...
@@ -31,11 +31,11 @@ protected override object GetValueWorker(string keyName)
}
bool
ISupportsNavigation
.
TryNavigateTo
(
bool
isPreview
)
=>
DefinitionBucket
.
DefinitionItem
.
TryNavigateTo
(
_p
resenter
.
_workspace
,
isPreview
);
=>
DefinitionBucket
.
DefinitionItem
.
TryNavigateTo
(
P
resenter
.
_workspace
,
isPreview
);
protected
override
IList
<
Inline
>
CreateLineTextInlines
()
=>
DefinitionBucket
.
DefinitionItem
.
DisplayParts
.
ToInlines
(
_presenter
.
ClassificationFormatMap
,
_p
resenter
.
TypeMap
);
.
ToInlines
(
Presenter
.
ClassificationFormatMap
,
P
resenter
.
TypeMap
);
}
}
}
src/Workspaces/Core/Portable/FindSymbols/FindReferences/BaseTypeFinder.cs
浏览文件 @
135744e7
...
...
@@ -35,16 +35,24 @@ public static ImmutableArray<ISymbol> FindBaseTypesAndInterfaces(INamedTypeSymbo
// We should add implementations only for overridden members but not for hidden ones.
// In the following example:
//
// interface I { void M(); }
// class A : I { public void M(); }
// class B : A { public new void M(); }
//
// we should not find anything for B.M() because it does not implement the interface:
//
// I i = new B(); i.M();
//
// will call the method from A.
// However, if we change the code to
//
// class B : A, I { public new void M(); }
//
// then
//
// I i = new B(); i.M();
//
// will call the method from B. We should find the base for B.M in this case.
// And if we change 'new' to 'override' in the original code and add 'virtual' where needed,
// we should find I.M as a base for B.M(). And the next line helps with this scenario.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录