Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
799b963c
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,发现更多精彩内容 >>
提交
799b963c
编写于
1月 31, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't group by definition when presenting result for FindImplementations or GoToDef.
上级
2e1cb224
变更
8
展开全部
显示空白变更内容
内联
并排
Showing
8 changed file
with
492 addition
and
321 deletion
+492
-321
src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs
...tures/Core/FindReferences/FindReferencesCommandHandler.cs
+1
-1
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
...itorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
+1
-5
src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs
...re/GoToImplementation/GoToImplementationCommandHandler.cs
+1
-2
src/EditorFeatures/Core/Host/IStreamingFindReferencesPresenter.cs
...orFeatures/Core/Host/IStreamingFindReferencesPresenter.cs
+4
-4
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.DocumentLocationEntry.cs
...ces/StreamingFindUsagesPresenter.DocumentLocationEntry.cs
+69
-27
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.RoslynDefinitionBucket.cs
...es/StreamingFindUsagesPresenter.RoslynDefinitionBucket.cs
+2
-2
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.TableDataSourceFindUsagesContext.cs
...ngFindUsagesPresenter.TableDataSourceFindUsagesContext.cs
+409
-277
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.cs
.../Core/Next/FindReferences/StreamingFindUsagesPresenter.cs
+5
-3
未找到文件。
src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs
浏览文件 @
799b963c
...
@@ -126,7 +126,7 @@ private IStreamingFindUsagesPresenter GetStreamingPresenter()
...
@@ -126,7 +126,7 @@ private IStreamingFindUsagesPresenter GetStreamingPresenter()
// Let the presented know we're starging a search. It will give us back
// Let the presented know we're starging a search. It will give us back
// the context object that the FAR service will push results into.
// the context object that the FAR service will push results into.
var
context
=
presenter
.
StartSearch
(
var
context
=
presenter
.
StartSearch
(
EditorFeaturesResources
.
Find_References
,
alwaysShowDeclarations
:
fals
e
);
EditorFeaturesResources
.
Find_References
,
canShowReferences
:
tru
e
);
await
findUsagesService
.
FindReferencesAsync
(
document
,
caretPosition
,
context
).
ConfigureAwait
(
false
);
await
findUsagesService
.
FindReferencesAsync
(
document
,
caretPosition
,
context
).
ConfigureAwait
(
false
);
// Note: we don't need to put this in a finally. The only time we might not hit
// Note: we don't need to put this in a finally. The only time we might not hit
...
...
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
浏览文件 @
799b963c
...
@@ -3,15 +3,12 @@
...
@@ -3,15 +3,12 @@
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Threading
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.Editor.FindReferences
;
using
Microsoft.CodeAnalysis.Editor.FindUsages
;
using
Microsoft.CodeAnalysis.Editor.FindUsages
;
using
Microsoft.CodeAnalysis.Editor.Host
;
using
Microsoft.CodeAnalysis.Editor.Host
;
using
Microsoft.CodeAnalysis.FindSymbols
;
using
Microsoft.CodeAnalysis.FindSymbols
;
using
Microsoft.CodeAnalysis.FindUsages
;
using
Microsoft.CodeAnalysis.FindUsages
;
using
Microsoft.CodeAnalysis.Navigation
;
using
Microsoft.CodeAnalysis.Navigation
;
using
Microsoft.CodeAnalysis.Options
;
using
Roslyn.Utilities
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.GoToDefinition
namespace
Microsoft.CodeAnalysis.Editor.GoToDefinition
...
@@ -75,8 +72,7 @@ internal static class GoToDefinitionHelpers
...
@@ -75,8 +72,7 @@ internal static class GoToDefinitionHelpers
FindUsagesHelpers
.
GetDisplayName
(
symbol
));
FindUsagesHelpers
.
GetDisplayName
(
symbol
));
return
presenter
.
TryNavigateToOrPresentItemsAsync
(
return
presenter
.
TryNavigateToOrPresentItemsAsync
(
title
,
definitions
.
ToImmutableAndFree
(),
title
,
definitions
.
ToImmutableAndFree
()).
WaitAndGetResult
(
cancellationToken
);
alwaysShowDeclarations
:
true
).
WaitAndGetResult
(
cancellationToken
);
}
}
private
static
IStreamingFindUsagesPresenter
GetFindUsagesPresenter
(
private
static
IStreamingFindUsagesPresenter
GetFindUsagesPresenter
(
...
...
src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs
浏览文件 @
799b963c
...
@@ -136,8 +136,7 @@ public void ExecuteCommand(GoToImplementationCommandArgs args, Action nextHandle
...
@@ -136,8 +136,7 @@ public void ExecuteCommand(GoToImplementationCommandArgs args, Action nextHandle
var
definitionItems
=
goToImplContext
.
GetDefinitions
();
var
definitionItems
=
goToImplContext
.
GetDefinitions
();
streamingPresenter
.
TryNavigateToOrPresentItemsAsync
(
streamingPresenter
.
TryNavigateToOrPresentItemsAsync
(
goToImplContext
.
SearchTitle
,
definitionItems
,
goToImplContext
.
SearchTitle
,
definitionItems
).
Wait
(
cancellationToken
);
alwaysShowDeclarations
:
true
).
Wait
(
cancellationToken
);
}
}
private
IStreamingFindUsagesPresenter
GetStreamingPresenter
()
private
IStreamingFindUsagesPresenter
GetStreamingPresenter
()
...
...
src/EditorFeatures/Core/Host/IStreamingFindReferencesPresenter.cs
浏览文件 @
799b963c
...
@@ -21,7 +21,7 @@ internal interface IStreamingFindUsagesPresenter
...
@@ -21,7 +21,7 @@ internal interface IStreamingFindUsagesPresenter
/// search completes <see cref="FindUsagesContext.OnCompletedAsync"/> should be called.
/// search completes <see cref="FindUsagesContext.OnCompletedAsync"/> should be called.
/// etc. etc.
/// etc. etc.
/// </summary>
/// </summary>
FindUsagesContext
StartSearch
(
string
title
,
bool
alwaysShowDeclaration
s
);
FindUsagesContext
StartSearch
(
string
title
,
bool
canShowReference
s
);
}
}
internal
static
class
IStreamingFindUsagesPresenterExtensions
internal
static
class
IStreamingFindUsagesPresenterExtensions
...
@@ -31,8 +31,8 @@ internal static class IStreamingFindUsagesPresenterExtensions
...
@@ -31,8 +31,8 @@ internal static class IStreamingFindUsagesPresenterExtensions
/// items to the user.
/// items to the user.
/// </summary>
/// </summary>
public
static
async
Task
<
bool
>
TryNavigateToOrPresentItemsAsync
(
public
static
async
Task
<
bool
>
TryNavigateToOrPresentItemsAsync
(
this
IStreamingFindUsagesPresenter
presenter
,
string
title
,
this
IStreamingFindUsagesPresenter
presenter
,
ImmutableArray
<
DefinitionItem
>
items
,
bool
alwaysShowDeclaration
s
)
string
title
,
ImmutableArray
<
DefinitionItem
>
item
s
)
{
{
// Ignore any definitions that we can't navigate to.
// Ignore any definitions that we can't navigate to.
var
definitions
=
items
.
WhereAsArray
(
d
=>
d
.
CanNavigateTo
());
var
definitions
=
items
.
WhereAsArray
(
d
=>
d
.
CanNavigateTo
());
...
@@ -66,7 +66,7 @@ internal static class IStreamingFindUsagesPresenterExtensions
...
@@ -66,7 +66,7 @@ internal static class IStreamingFindUsagesPresenterExtensions
// We have multiple definitions, or we have definitions with multiple locations.
// We have multiple definitions, or we have definitions with multiple locations.
// Present this to the user so they can decide where they want to go to.
// Present this to the user so they can decide where they want to go to.
var
context
=
presenter
.
StartSearch
(
title
,
alwaysShowDeclarations
);
var
context
=
presenter
.
StartSearch
(
title
,
canShowReferences
:
false
);
foreach
(
var
definition
in
nonExternalItems
)
foreach
(
var
definition
in
nonExternalItems
)
{
{
await
context
.
OnDefinitionFoundAsync
(
definition
).
ConfigureAwait
(
false
);
await
context
.
OnDefinitionFoundAsync
(
definition
).
ConfigureAwait
(
false
);
...
...
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.DocumentLocationEntry.cs
浏览文件 @
799b963c
...
@@ -27,39 +27,33 @@ namespace Microsoft.VisualStudio.LanguageServices.FindUsages
...
@@ -27,39 +27,33 @@ namespace Microsoft.VisualStudio.LanguageServices.FindUsages
{
{
internal
partial
class
StreamingFindUsagesPresenter
internal
partial
class
StreamingFindUsagesPresenter
{
{
private
class
DocumentSpanEntry
:
Entry
private
abstract
class
Abstract
DocumentSpanEntry
:
Entry
{
{
private
readonly
TableDataSourceFindUsagesContext
_context
;
private
readonly
Abstract
TableDataSourceFindUsagesContext
_context
;
private
readonly
DocumentSpan
_documentSpan
;
private
readonly
DocumentSpan
_documentSpan
;
private
readonly
bool
_isDefinitionLocation
;
private
readonly
object
_boxedProjectGuid
;
private
readonly
object
_boxedProjectGuid
;
private
readonly
SourceText
_sourceText
;
protected
readonly
SourceText
_sourceText
;
private
readonly
ClassifiedSpansAndHighlightSpan
_classifiedSpans
;
p
ublic
DocumentSpanEntry
(
p
rotected
Abstract
DocumentSpanEntry
(
TableDataSourceFindUsagesContext
context
,
Abstract
TableDataSourceFindUsagesContext
context
,
RoslynDefinitionBucket
definitionBucket
,
RoslynDefinitionBucket
definitionBucket
,
DocumentSpan
documentSpan
,
DocumentSpan
documentSpan
,
bool
isDefinitionLocation
,
Guid
projectGuid
,
Guid
projectGuid
,
SourceText
sourceText
,
SourceText
sourceText
)
ClassifiedSpansAndHighlightSpan
classifiedSpans
)
:
base
(
definitionBucket
)
:
base
(
definitionBucket
)
{
{
_context
=
context
;
_context
=
context
;
_documentSpan
=
documentSpan
;
_documentSpan
=
documentSpan
;
_isDefinitionLocation
=
isDefinitionLocation
;
_boxedProjectGuid
=
projectGuid
;
_boxedProjectGuid
=
projectGuid
;
_sourceText
=
sourceText
;
_sourceText
=
sourceText
;
_classifiedSpans
=
classifiedSpans
;
}
}
pr
ivate
StreamingFindUsagesPresenter
Presenter
=>
_context
.
Presenter
;
pr
otected
StreamingFindUsagesPresenter
Presenter
=>
_context
.
Presenter
;
pr
ivate
Document
Document
=>
_documentSpan
.
Document
;
pr
otected
Document
Document
=>
_documentSpan
.
Document
;
pr
ivate
TextSpan
SourceSpan
=>
_documentSpan
.
SourceSpan
;
pr
otected
TextSpan
SourceSpan
=>
_documentSpan
.
SourceSpan
;
protected
override
object
GetValueWorker
(
string
keyName
)
protected
override
object
GetValueWorker
(
string
keyName
)
{
{
...
@@ -81,6 +75,54 @@ protected override object GetValueWorker(string keyName)
...
@@ -81,6 +75,54 @@ protected override object GetValueWorker(string keyName)
return
null
;
return
null
;
}
}
}
private
class
DefinitionItemEntry
:
AbstractDocumentSpanEntry
{
public
DefinitionItemEntry
(
AbstractTableDataSourceFindUsagesContext
context
,
RoslynDefinitionBucket
definitionBucket
,
DocumentSpan
documentSpan
,
Guid
projectGuid
,
SourceText
sourceText
)
:
base
(
context
,
definitionBucket
,
documentSpan
,
projectGuid
,
sourceText
)
{
}
public
override
bool
TryCreateColumnContent
(
string
columnName
,
out
FrameworkElement
content
)
{
if
(
columnName
==
StandardTableColumnDefinitions2
.
LineText
)
{
var
inlines
=
DefinitionBucket
.
DefinitionItem
.
DisplayParts
.
ToInlines
(
Presenter
.
_typeMap
);
var
textBlock
=
inlines
.
ToTextBlock
(
Presenter
.
_typeMap
,
wrap
:
false
);
content
=
textBlock
;
return
true
;
}
content
=
null
;
return
false
;
}
}
private
class
DocumentSpanEntry
:
AbstractDocumentSpanEntry
{
private
readonly
bool
_isDefinitionLocation
;
private
readonly
ClassifiedSpansAndHighlightSpan
_classifiedSpans
;
public
DocumentSpanEntry
(
AbstractTableDataSourceFindUsagesContext
context
,
RoslynDefinitionBucket
definitionBucket
,
DocumentSpan
documentSpan
,
bool
isDefinitionLocation
,
Guid
projectGuid
,
SourceText
sourceText
,
ClassifiedSpansAndHighlightSpan
classifiedSpans
)
:
base
(
context
,
definitionBucket
,
documentSpan
,
projectGuid
,
sourceText
)
{
_isDefinitionLocation
=
isDefinitionLocation
;
_classifiedSpans
=
classifiedSpans
;
}
public
override
bool
TryCreateColumnContent
(
string
columnName
,
out
FrameworkElement
content
)
public
override
bool
TryCreateColumnContent
(
string
columnName
,
out
FrameworkElement
content
)
{
{
...
...
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.RoslynDefinitionBucket.cs
浏览文件 @
799b963c
...
@@ -17,13 +17,13 @@ internal partial class StreamingFindUsagesPresenter
...
@@ -17,13 +17,13 @@ internal partial class StreamingFindUsagesPresenter
private
class
RoslynDefinitionBucket
:
DefinitionBucket
,
ISupportsNavigation
private
class
RoslynDefinitionBucket
:
DefinitionBucket
,
ISupportsNavigation
{
{
private
readonly
StreamingFindUsagesPresenter
_presenter
;
private
readonly
StreamingFindUsagesPresenter
_presenter
;
private
readonly
TableDataSourceFindUsagesContext
_context
;
private
readonly
Abstract
TableDataSourceFindUsagesContext
_context
;
public
readonly
DefinitionItem
DefinitionItem
;
public
readonly
DefinitionItem
DefinitionItem
;
public
RoslynDefinitionBucket
(
public
RoslynDefinitionBucket
(
StreamingFindUsagesPresenter
presenter
,
StreamingFindUsagesPresenter
presenter
,
TableDataSourceFindUsagesContext
context
,
Abstract
TableDataSourceFindUsagesContext
context
,
DefinitionItem
definitionItem
)
DefinitionItem
definitionItem
)
:
base
(
name
:
definitionItem
.
DisplayParts
.
JoinText
()
+
" "
+
definitionItem
.
GetHashCode
(),
:
base
(
name
:
definitionItem
.
DisplayParts
.
JoinText
()
+
" "
+
definitionItem
.
GetHashCode
(),
sourceTypeIdentifier
:
context
.
SourceTypeIdentifier
,
sourceTypeIdentifier
:
context
.
SourceTypeIdentifier
,
...
...
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.TableDataSourceFindUsagesContext.cs
浏览文件 @
799b963c
此差异已折叠。
点击以展开。
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.cs
浏览文件 @
799b963c
...
@@ -60,7 +60,7 @@ internal partial class StreamingFindUsagesPresenter :
...
@@ -60,7 +60,7 @@ internal partial class StreamingFindUsagesPresenter :
_vsFindAllReferencesService
=
(
IFindAllReferencesService
)
_serviceProvider
.
GetService
(
typeof
(
SVsFindAllReferences
));
_vsFindAllReferencesService
=
(
IFindAllReferencesService
)
_serviceProvider
.
GetService
(
typeof
(
SVsFindAllReferences
));
}
}
public
FindUsagesContext
StartSearch
(
string
title
,
bool
alwaysShowDeclaration
s
)
public
FindUsagesContext
StartSearch
(
string
title
,
bool
canShowReference
s
)
{
{
this
.
AssertIsForeground
();
this
.
AssertIsForeground
();
...
@@ -68,8 +68,10 @@ public FindUsagesContext StartSearch(string title, bool alwaysShowDeclarations)
...
@@ -68,8 +68,10 @@ public FindUsagesContext StartSearch(string title, bool alwaysShowDeclarations)
var
window
=
_vsFindAllReferencesService
.
StartSearch
(
title
);
var
window
=
_vsFindAllReferencesService
.
StartSearch
(
title
);
// Make the data source that will feed data into this window.
// Make the data source that will feed data into this window.
var
dataSource
=
new
TableDataSourceFindUsagesContext
(
this
,
window
,
alwaysShowDeclarations
);
var
dataSource
=
canShowReferences
?
(
AbstractTableDataSourceFindUsagesContext
)
new
WithReferencesFindUsagesContext
(
this
,
window
)
:
new
WithoutReferencesFindUsagesContext
(
this
,
window
);
// And return the data source so that the FindRefs engine can report results
// And return the data source so that the FindRefs engine can report results
// which the data source can then create the appropriate presentation items for
// which the data source can then create the appropriate presentation items for
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录