Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
20347f68
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,发现更多精彩内容 >>
提交
20347f68
编写于
11月 30, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't filter for goto-def and goto-impl.
上级
0b79656b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
45 addition
and
40 deletion
+45
-40
src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs
...tures/Core/FindReferences/FindReferencesCommandHandler.cs
+2
-1
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
...itorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
+2
-1
src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs
...re/GoToImplementation/GoToImplementationCommandHandler.cs
+2
-1
src/EditorFeatures/Core/Host/IStreamingFindReferencesPresenter.cs
...orFeatures/Core/Host/IStreamingFindReferencesPresenter.cs
+4
-4
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.TableDataSourceFindUsagesContext.cs
...ngFindUsagesPresenter.TableDataSourceFindUsagesContext.cs
+32
-31
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.cs
.../Core/Next/FindReferences/StreamingFindUsagesPresenter.cs
+3
-2
未找到文件。
src/EditorFeatures/Core/FindReferences/FindReferencesCommandHandler.cs
浏览文件 @
20347f68
...
...
@@ -125,7 +125,8 @@ private IStreamingFindUsagesPresenter GetStreamingPresenter()
{
// 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.
var
context
=
presenter
.
StartSearch
(
EditorFeaturesResources
.
Find_References
);
var
context
=
presenter
.
StartSearch
(
EditorFeaturesResources
.
Find_References
,
alwaysShowDeclarations
:
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
...
...
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
浏览文件 @
20347f68
...
...
@@ -71,7 +71,8 @@ internal static class GoToDefinitionHelpers
var
presenter
=
GetFindUsagesPresenter
(
streamingPresenters
);
return
presenter
.
TryNavigateToOrPresentItemsAsync
(
EditorFeaturesResources
.
Go_to_Definition
,
definitions
.
ToImmutableAndFree
()).
WaitAndGetResult
(
cancellationToken
);
definitions
.
ToImmutableAndFree
(),
alwaysShowDeclarations
:
true
).
WaitAndGetResult
(
cancellationToken
);
}
private
static
IStreamingFindUsagesPresenter
GetFindUsagesPresenter
(
...
...
src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs
浏览文件 @
20347f68
...
...
@@ -125,7 +125,8 @@ private void ExecuteCommand(Document document, int caretPosition)
var
definitionItems
=
goToImplContext
.
GetDefinitions
();
streamingPresenter
.
TryNavigateToOrPresentItemsAsync
(
EditorFeaturesResources
.
Go_To_Implementation
,
definitionItems
).
Wait
(
cancellationToken
);
EditorFeaturesResources
.
Go_To_Implementation
,
definitionItems
,
alwaysShowDeclarations
:
true
).
Wait
(
cancellationToken
);
}
private
IStreamingFindUsagesPresenter
GetStreamingPresenter
()
...
...
src/EditorFeatures/Core/Host/IStreamingFindReferencesPresenter.cs
浏览文件 @
20347f68
...
...
@@ -21,7 +21,7 @@ internal interface IStreamingFindUsagesPresenter
/// search completes <see cref="FindUsagesContext.OnCompletedAsync"/> should be called.
/// etc. etc.
/// </summary>
FindUsagesContext
StartSearch
(
string
title
);
FindUsagesContext
StartSearch
(
string
title
,
bool
alwaysShowDeclarations
);
}
internal
static
class
IStreamingFindUsagesPresenterExtensions
...
...
@@ -31,8 +31,8 @@ internal static class IStreamingFindUsagesPresenterExtensions
/// items to the user.
/// </summary>
public
static
async
Task
<
bool
>
TryNavigateToOrPresentItemsAsync
(
this
IStreamingFindUsagesPresenter
presenter
,
string
title
,
ImmutableArray
<
DefinitionItem
>
item
s
)
this
IStreamingFindUsagesPresenter
presenter
,
string
title
,
ImmutableArray
<
DefinitionItem
>
items
,
bool
alwaysShowDeclaration
s
)
{
// Ignore any definitions that we can't navigate to.
var
definitions
=
items
.
WhereAsArray
(
d
=>
d
.
CanNavigateTo
());
...
...
@@ -66,7 +66,7 @@ internal static class IStreamingFindUsagesPresenterExtensions
// 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.
var
context
=
presenter
.
StartSearch
(
title
);
var
context
=
presenter
.
StartSearch
(
title
,
alwaysShowDeclarations
);
foreach
(
var
definition
in
nonExternalItems
)
{
await
context
.
OnDefinitionFoundAsync
(
definition
).
ConfigureAwait
(
false
);
...
...
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.TableDataSourceFindUsagesContext.cs
浏览文件 @
20347f68
...
...
@@ -34,6 +34,7 @@ private class TableDataSourceFindUsagesContext :
public
readonly
StreamingFindUsagesPresenter
Presenter
;
private
readonly
IFindAllReferencesWindow
_findReferencesWindow
;
private
readonly
IWpfTableControl2
_tableControl
;
private
readonly
bool
_alwaysIncludeDeclarations
;
private
readonly
object
_gate
=
new
object
();
...
...
@@ -67,8 +68,8 @@ private class TableDataSourceFindUsagesContext :
/// </summary>
private
bool
_currentlyGroupingByDefinition
;
private
ImmutableList
<
Entry
>
_entriesW
henGroupingByDefinition
=
ImmutableList
<
Entry
>.
Empty
;
private
ImmutableList
<
Entry
>
_entriesW
henNotGroupingByDefinition
=
ImmutableList
<
Entry
>.
Empty
;
private
ImmutableList
<
Entry
>
_entriesW
ithDeclarations
=
ImmutableList
<
Entry
>.
Empty
;
private
ImmutableList
<
Entry
>
_entriesW
ithoutDeclarations
=
ImmutableList
<
Entry
>.
Empty
;
private
TableEntriesSnapshot
_lastSnapshot
;
public
int
CurrentVersionNumber
{
get
;
private
set
;
}
...
...
@@ -77,11 +78,13 @@ private class TableDataSourceFindUsagesContext :
public
TableDataSourceFindUsagesContext
(
StreamingFindUsagesPresenter
presenter
,
IFindAllReferencesWindow
findReferencesWindow
)
IFindAllReferencesWindow
findReferencesWindow
,
bool
alwaysIncludeDeclarations
)
{
presenter
.
AssertIsForeground
();
Presenter
=
presenter
;
_alwaysIncludeDeclarations
=
alwaysIncludeDeclarations
;
_findReferencesWindow
=
findReferencesWindow
;
_tableControl
=
(
IWpfTableControl2
)
findReferencesWindow
.
TableControl
;
_tableControl
.
GroupingsChanged
+=
OnTableControlGroupingsChanged
;
...
...
@@ -227,8 +230,8 @@ private async Task CreateNoResultsFoundEntryIfNecessaryAsync()
await
OnEntryFoundAsync
(
NoResultsDefinitionItem
,
bucket
=>
SimpleMessageEntry
.
CreateAsync
(
bucket
,
ServicesVisualStudioNextResources
.
Search_found_no_results
),
showEntryWhenGroupingByDefinition
:
true
,
showEntryWhenNotGroupingByDefinition
:
true
).
ConfigureAwait
(
false
);
addToEntriesWithDeclarations
:
true
,
addToEntriesWithoutDeclarations
:
true
).
ConfigureAwait
(
false
);
}
}
...
...
@@ -241,17 +244,17 @@ private async Task CreateNoResultsFoundEntryIfNecessaryAsync()
private
async
Task
CreateMissingReferenceEntriesIfNecessaryAsync
()
{
await
CreateMissingReferenceEntriesIfNecessaryAsync
(
w
henGroupingByDefinition
:
true
).
ConfigureAwait
(
false
);
await
CreateMissingReferenceEntriesIfNecessaryAsync
(
w
henGroupingByDefinition
:
false
).
ConfigureAwait
(
false
);
await
CreateMissingReferenceEntriesIfNecessaryAsync
(
w
ithDeclarations
:
true
).
ConfigureAwait
(
false
);
await
CreateMissingReferenceEntriesIfNecessaryAsync
(
w
ithDeclarations
:
false
).
ConfigureAwait
(
false
);
}
private
async
Task
CreateMissingReferenceEntriesIfNecessaryAsync
(
bool
w
henGroupingByDefinition
)
bool
w
ithDeclarations
)
{
// Go through and add dummy entries for any definitions that
// that we didn't find any references for.
var
definitions
=
GetDefinitionsToCreateMissingReferenceItemsFor
(
w
henGroupingByDefinition
);
var
definitions
=
GetDefinitionsToCreateMissingReferenceItemsFor
(
w
ithDeclarations
);
foreach
(
var
definition
in
definitions
)
{
// Create a fake reference to this definition that says
...
...
@@ -259,8 +262,8 @@ private async Task CreateMissingReferenceEntriesIfNecessaryAsync()
await
OnEntryFoundAsync
(
definition
,
bucket
=>
SimpleMessageEntry
.
CreateAsync
(
bucket
,
GetMessage
(
bucket
.
DefinitionItem
)),
showEntryWhenGroupingByDefinition
:
whenGroupingByDefinition
,
showEntryWhenNotGroupingByDefinition
:
!
whenGroupingByDefinition
).
ConfigureAwait
(
false
);
addToEntriesWithDeclarations
:
withDeclarations
,
addToEntriesWithoutDeclarations
:
!
withDeclarations
).
ConfigureAwait
(
false
);
}
}
...
...
@@ -277,13 +280,13 @@ private static string GetMessage(DefinitionItem definition)
}
private
ImmutableArray
<
DefinitionItem
>
GetDefinitionsToCreateMissingReferenceItemsFor
(
bool
w
henGroupingByDefinition
)
bool
w
ithDeclarations
)
{
lock
(
_gate
)
{
var
entries
=
w
henGroupingByDefinition
?
_entriesW
henGroupingByDefinition
:
_entriesW
henNotGroupingByDefinition
;
var
entries
=
w
ithDeclarations
?
_entriesW
ithDeclarations
:
_entriesW
ithoutDeclarations
;
// Find any definitions that we didn't have any references to. But only show
// them if they want to be displayed without any references. This will
...
...
@@ -334,9 +337,7 @@ private bool HasDeclarationEntries(DefinitionItem definition)
{
lock
(
_gate
)
{
// We only store declaration entries in the entries list we use when
// we're not grouping by definition.
return
_entriesWhenNotGroupingByDefinition
.
Any
(
e
=>
e
.
DefinitionBucket
.
DefinitionItem
==
definition
);
return
_entriesWithDeclarations
.
Any
(
e
=>
e
.
DefinitionBucket
.
DefinitionItem
==
definition
);
}
}
...
...
@@ -375,7 +376,7 @@ private async Task AddDeclarationEntriesAsync(DefinitionItem definition)
{
// We only include declaration entries in the entries we show when
// not grouping by definition.
_entriesW
henNotGroupingByDefinition
=
_entriesWhenNotGroupingByDefinition
.
AddRange
(
declarations
);
_entriesW
ithDeclarations
=
_entriesWithDeclarations
.
AddRange
(
declarations
);
CurrentVersionNumber
++;
}
}
...
...
@@ -393,17 +394,17 @@ public override Task OnReferenceFoundAsync(SourceReferenceItem reference)
reference
.
Definition
,
bucket
=>
CreateDocumentLocationEntryAsync
(
bucket
,
reference
.
SourceSpan
,
isDefinitionLocation
:
false
),
showEntryWhenGroupingByDefinition
:
true
,
showEntryWhenNotGroupingByDefinition
:
true
);
addToEntriesWithDeclarations
:
true
,
addToEntriesWithoutDeclarations
:
true
);
}
private
async
Task
OnEntryFoundAsync
(
DefinitionItem
definition
,
Func
<
RoslynDefinitionBucket
,
Task
<
Entry
>>
createEntryAsync
,
bool
showEntryWhenGroupingByDefinition
,
bool
showEntryWhenNotGroupingByDefinition
)
bool
addToEntriesWithDeclarations
,
bool
addToEntriesWithoutDeclarations
)
{
Debug
.
Assert
(
showEntryWhenGroupingByDefinition
||
showEntryWhenNotGroupingByDefinition
);
Debug
.
Assert
(
addToEntriesWithDeclarations
||
addToEntriesWithoutDeclarations
);
CancellationToken
.
ThrowIfCancellationRequested
();
// First find the bucket corresponding to our definition.
...
...
@@ -421,14 +422,14 @@ public override Task OnReferenceFoundAsync(SourceReferenceItem reference)
lock
(
_gate
)
{
// Once we can make the new entry, add it to the appropriate list.
if
(
showEntryWhenGroupingByDefinition
)
if
(
addToEntriesWithDeclarations
)
{
_entriesW
henGroupingByDefinition
=
_entriesWhenGroupingByDefinition
.
Add
(
entry
);
_entriesW
ithDeclarations
=
_entriesWithDeclarations
.
Add
(
entry
);
}
if
(
showEntryWhenNotGroupingByDefinition
)
if
(
addToEntriesWithoutDeclarations
)
{
_entriesW
henNotGroupingByDefinition
=
_entriesWhenNotGroupingByDefinition
.
Add
(
entry
);
_entriesW
ithoutDeclarations
=
_entriesWithoutDeclarations
.
Add
(
entry
);
}
CurrentVersionNumber
++;
...
...
@@ -704,9 +705,9 @@ public ITableEntriesSnapshot GetCurrentSnapshot()
// our version.
if
(
_lastSnapshot
?.
VersionNumber
!=
CurrentVersionNumber
)
{
var
entries
=
_currentlyGroupingByDefinition
?
_entriesW
henGroupingByDefinition
:
_entriesW
henNotGroupingByDefinition
;
var
entries
=
_currentlyGroupingByDefinition
&&
!
_alwaysIncludeDeclarations
?
_entriesW
ithoutDeclarations
:
_entriesW
ithDeclarations
;
_lastSnapshot
=
new
TableEntriesSnapshot
(
entries
,
CurrentVersionNumber
);
}
...
...
src/VisualStudio/Core/Next/FindReferences/StreamingFindUsagesPresenter.cs
浏览文件 @
20347f68
...
...
@@ -60,7 +60,7 @@ internal partial class StreamingFindUsagesPresenter :
_vsFindAllReferencesService
=
(
IFindAllReferencesService
)
_serviceProvider
.
GetService
(
typeof
(
SVsFindAllReferences
));
}
public
FindUsagesContext
StartSearch
(
string
title
)
public
FindUsagesContext
StartSearch
(
string
title
,
bool
alwaysShowDeclarations
)
{
this
.
AssertIsForeground
();
...
...
@@ -68,7 +68,8 @@ public FindUsagesContext StartSearch(string title)
var
window
=
_vsFindAllReferencesService
.
StartSearch
(
title
);
// Make the data source that will feed data into this window.
var
dataSource
=
new
TableDataSourceFindUsagesContext
(
this
,
window
);
var
dataSource
=
new
TableDataSourceFindUsagesContext
(
this
,
window
,
alwaysShowDeclarations
);
// 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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录