Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
bbe1d6b2
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,发现更多精彩内容 >>
提交
bbe1d6b2
编写于
4月 20, 2020
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Siplify code
上级
05b2ed1b
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
63 addition
and
73 deletion
+63
-73
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.ProgressAdapter.cs
...e/FindUsages/AbstractFindUsagesService.ProgressAdapter.cs
+1
-2
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
...itorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
+10
-18
src/EditorFeatures/Core/FindUsages/FindUsagesHelpers.cs
src/EditorFeatures/Core/FindUsages/FindUsagesHelpers.cs
+6
-6
src/EditorFeatures/Core/FindUsages/IDefinitionsAndReferencesFactory.cs
...tures/Core/FindUsages/IDefinitionsAndReferencesFactory.cs
+7
-7
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
+6
-8
src/EditorFeatures/Core/GoToBase/FindBaseHelpers.cs
src/EditorFeatures/Core/GoToBase/FindBaseHelpers.cs
+2
-3
src/EditorFeatures/Core/GoToDefinition/AbstractGoToDefinitionService.cs
...ures/Core/GoToDefinition/AbstractGoToDefinitionService.cs
+2
-2
src/EditorFeatures/Core/GoToDefinition/AbstractGoToSymbolService.cs
...Features/Core/GoToDefinition/AbstractGoToSymbolService.cs
+3
-2
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
...itorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
+8
-9
src/EditorFeatures/Core/Implementation/IntelliSense/Helpers.cs
...ditorFeatures/Core/Implementation/IntelliSense/Helpers.cs
+1
-1
src/EditorFeatures/Core/Implementation/Peek/PeekableItemFactory.cs
...rFeatures/Core/Implementation/Peek/PeekableItemFactory.cs
+1
-1
src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.NavigableSymbol.cs
...avigableSymbols/NavigableSymbolService.NavigableSymbol.cs
+1
-1
src/Features/Core/Portable/FindUsages/DefinitionItem.cs
src/Features/Core/Portable/FindUsages/DefinitionItem.cs
+6
-3
src/Tools/ExternalAccess/Debugger/DebuggerFindReferencesService.cs
.../ExternalAccess/Debugger/DebuggerFindReferencesService.cs
+2
-1
src/VisualStudio/Core/Def/Implementation/Library/ObjectBrowser/AbstractObjectBrowserLibraryManager.cs
...rary/ObjectBrowser/AbstractObjectBrowserLibraryManager.cs
+1
-2
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioSymbolNavigationService.cs
...entation/Workspace/VisualStudioSymbolNavigationService.cs
+3
-3
src/VisualStudio/Core/Impl/RoslynVisualStudioWorkspace.cs
src/VisualStudio/Core/Impl/RoslynVisualStudioWorkspace.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/FindReferences/BaseTypeFinder.cs
...ore/Portable/FindSymbols/FindReferences/BaseTypeFinder.cs
+1
-2
src/Workspaces/CoreTest/FindReferencesTests.cs
src/Workspaces/CoreTest/FindReferencesTests.cs
+1
-1
未找到文件。
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.ProgressAdapter.cs
浏览文件 @
bbe1d6b2
...
...
@@ -102,8 +102,7 @@ private async Task<DefinitionItem> GetDefinitionItemAsync(ISymbol definition)
if
(!
_definitionToItem
.
TryGetValue
(
definition
,
out
var
definitionItem
))
{
definitionItem
=
await
definition
.
ToClassifiedDefinitionItemAsync
(
_solution
.
GetOriginatingProject
(
definition
),
includeHiddenLocations
:
false
,
_options
,
_context
.
CancellationToken
).
ConfigureAwait
(
false
);
_solution
,
includeHiddenLocations
:
false
,
_options
,
_context
.
CancellationToken
).
ConfigureAwait
(
false
);
_definitionToItem
[
definition
]
=
definitionItem
;
}
...
...
src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService.cs
浏览文件 @
bbe1d6b2
...
...
@@ -52,8 +52,7 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
foreach
(
var
implementation
in
implementations
)
{
var
definitionItem
=
await
implementation
.
ToClassifiedDefinitionItemAsync
(
solution
.
GetOriginatingProject
(
implementation
),
includeHiddenLocations
:
false
,
FindReferencesSearchOptions
.
Default
,
cancellationToken
).
ConfigureAwait
(
false
);
solution
,
includeHiddenLocations
:
false
,
FindReferencesSearchOptions
.
Default
,
cancellationToken
).
ConfigureAwait
(
false
);
await
context
.
OnDefinitionFoundAsync
(
definitionItem
).
ConfigureAwait
(
false
);
}
...
...
@@ -122,16 +121,16 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
cancellationToken
.
ThrowIfCancellationRequested
();
// Find the symbol we want to search and the solution we want to search in.
var
symbolAnd
ProjectOpt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndProject
AtPositionAsync
(
var
symbolAnd
SolutionOpt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndSolution
AtPositionAsync
(
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
symbolAnd
Project
Opt
==
null
)
if
(
symbolAnd
Solution
Opt
==
null
)
return
;
var
(
symbol
,
project
)
=
symbolAndProject
Opt
.
Value
;
var
(
symbol
,
solution
)
=
symbolAndSolution
Opt
.
Value
;
await
FindSymbolReferencesAsync
(
_threadingContext
,
context
,
symbol
,
project
,
symbol
,
solution
,
cancellationToken
).
ConfigureAwait
(
false
);
}
...
...
@@ -141,9 +140,9 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
/// </summary>
public
static
async
Task
FindSymbolReferencesAsync
(
IThreadingContext
threadingContext
,
IFindUsagesContext
context
,
ISymbol
symbol
,
Project
project
,
CancellationToken
cancellationToken
)
ISymbol
symbol
,
Solution
solution
,
CancellationToken
cancellationToken
)
{
var
monikerUsagesService
=
project
.
S
olution
.
Workspace
.
Services
.
GetRequiredService
<
IFindSymbolMonikerUsagesService
>();
var
monikerUsagesService
=
s
olution
.
Workspace
.
Services
.
GetRequiredService
<
IFindSymbolMonikerUsagesService
>();
await
context
.
SetSearchTitleAsync
(
string
.
Format
(
EditorFeaturesResources
.
_0_references
,
FindUsagesHelpers
.
GetDisplayName
(
symbol
))).
ConfigureAwait
(
false
);
...
...
@@ -154,20 +153,13 @@ protected AbstractFindUsagesService(IThreadingContext threadingContext)
// engine will push results into the 'progress' instance passed into it.
// We'll take those results, massage them, and forward them along to the
// FindReferencesContext instance we were given.
var
progress
=
new
FindReferencesProgressAdapter
(
threadingContext
,
solution
,
context
,
options
);
var
normalFindReferencesTask
=
SymbolFinder
.
FindReferencesAsync
(
symbol
,
project
.
Solution
,
new
FindReferencesProgressAdapter
(
threadingContext
,
project
.
Solution
,
context
,
options
),
documents
:
null
,
options
,
cancellationToken
);
symbol
,
solution
,
progress
,
documents
:
null
,
options
,
cancellationToken
);
// Kick off work to search the online code index system in parallel
var
codeIndexReferencesTask
=
FindSymbolMonikerReferencesAsync
(
monikerUsagesService
,
symbol
,
context
,
cancellationToken
);
monikerUsagesService
,
symbol
,
context
,
cancellationToken
);
await
Task
.
WhenAll
(
normalFindReferencesTask
,
codeIndexReferencesTask
).
ConfigureAwait
(
false
);
}
...
...
src/EditorFeatures/Core/FindUsages/FindUsagesHelpers.cs
浏览文件 @
bbe1d6b2
...
...
@@ -31,7 +31,7 @@ public static string GetDisplayName(ISymbol symbol)
/// there may be symbol mapping involved (for example in Metadata-As-Source
/// scenarios).
/// </summary>
public
static
async
Task
<(
ISymbol
symbol
,
Project
project
)?>
GetRelevantSymbolAndProject
AtPositionAsync
(
public
static
async
Task
<(
ISymbol
symbol
,
Solution
solution
)?>
GetRelevantSymbolAndSolution
AtPositionAsync
(
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
{
cancellationToken
.
ThrowIfCancellationRequested
();
...
...
@@ -49,19 +49,19 @@ public static string GetDisplayName(ISymbol symbol)
if
(
mapping
==
null
)
return
null
;
return
(
mapping
.
Symbol
,
mapping
.
Project
);
return
(
mapping
.
Symbol
,
mapping
.
Project
.
Solution
);
}
public
static
async
Task
<(
Solution
solution
,
ISymbol
symbol
,
ImmutableArray
<
ISymbol
>
implementations
,
string
message
)?>
FindSourceImplementationsAsync
(
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
{
var
symbolAnd
ProjectOpt
=
await
GetRelevantSymbolAndProject
AtPositionAsync
(
var
symbolAnd
SolutionOpt
=
await
GetRelevantSymbolAndSolution
AtPositionAsync
(
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
symbolAnd
Project
Opt
==
null
)
if
(
symbolAnd
Solution
Opt
==
null
)
return
null
;
var
(
symbol
,
project
)
=
symbolAndProject
Opt
.
Value
;
var
(
symbol
,
solution
)
=
symbolAndSolution
Opt
.
Value
;
return
await
FindSourceImplementationsAsync
(
project
.
S
olution
,
symbol
,
cancellationToken
).
ConfigureAwait
(
false
);
s
olution
,
symbol
,
cancellationToken
).
ConfigureAwait
(
false
);
}
private
static
async
Task
<(
Solution
solution
,
ISymbol
symbol
,
ImmutableArray
<
ISymbol
>
implementations
,
string
message
)?>
FindSourceImplementationsAsync
(
...
...
src/EditorFeatures/Core/FindUsages/IDefinitionsAndReferencesFactory.cs
浏览文件 @
bbe1d6b2
...
...
@@ -53,7 +53,7 @@ internal static class DefinitionItemExtensions
{
public
static
DefinitionItem
ToNonClassifiedDefinitionItem
(
this
ISymbol
definition
,
Project
project
,
Solution
solution
,
bool
includeHiddenLocations
)
{
// Because we're passing in 'false' for 'includeClassifiedSpans', this won't ever have
...
...
@@ -61,25 +61,25 @@ internal static class DefinitionItemExtensions
// to compute the classified spans for the locations of the definition. So it's totally
// fine to pass in CancellationToken.None and block on the result.
return
ToDefinitionItemAsync
(
definition
,
project
,
includeHiddenLocations
,
includeClassifiedSpans
:
false
,
definition
,
solution
,
includeHiddenLocations
,
includeClassifiedSpans
:
false
,
options
:
FindReferencesSearchOptions
.
Default
,
cancellationToken
:
CancellationToken
.
None
).
WaitAndGetResult_CanCallOnBackground
(
CancellationToken
.
None
);
}
public
static
Task
<
DefinitionItem
>
ToClassifiedDefinitionItemAsync
(
this
ISymbol
definition
,
Project
project
,
Solution
solution
,
bool
includeHiddenLocations
,
FindReferencesSearchOptions
options
,
CancellationToken
cancellationToken
)
{
return
ToDefinitionItemAsync
(
definition
,
project
,
return
ToDefinitionItemAsync
(
definition
,
solution
,
includeHiddenLocations
,
includeClassifiedSpans
:
true
,
options
,
cancellationToken
);
}
private
static
async
Task
<
DefinitionItem
>
ToDefinitionItemAsync
(
this
ISymbol
definition
,
Project
project
,
Solution
solution
,
bool
includeHiddenLocations
,
bool
includeClassifiedSpans
,
FindReferencesSearchOptions
options
,
...
...
@@ -121,7 +121,7 @@ internal static class DefinitionItemExtensions
if
(
location
.
IsInMetadata
)
{
return
DefinitionItem
.
CreateMetadataDefinition
(
tags
,
displayParts
,
nameDisplayParts
,
project
,
tags
,
displayParts
,
nameDisplayParts
,
solution
,
definition
,
properties
,
displayIfNoReferences
);
}
else
if
(
location
.
IsInSource
)
...
...
@@ -132,7 +132,7 @@ internal static class DefinitionItemExtensions
continue
;
}
var
document
=
project
.
S
olution
.
GetDocument
(
location
.
SourceTree
);
var
document
=
s
olution
.
GetDocument
(
location
.
SourceTree
);
if
(
document
!=
null
)
{
var
documentLocation
=
!
includeClassifiedSpans
...
...
src/EditorFeatures/Core/GoToBase/AbstractGoToBaseService.cs
浏览文件 @
bbe1d6b2
...
...
@@ -16,21 +16,20 @@ internal abstract partial class AbstractGoToBaseService : IGoToBaseService
public
async
Task
FindBasesAsync
(
Document
document
,
int
position
,
IFindUsagesContext
context
)
{
var
cancellationToken
=
context
.
CancellationToken
;
var
symbolAnd
ProjectOpt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndProject
AtPositionAsync
(
var
symbolAnd
SolutionOpt
=
await
FindUsagesHelpers
.
GetRelevantSymbolAndSolution
AtPositionAsync
(
document
,
position
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
symbolAnd
Project
Opt
==
null
)
if
(
symbolAnd
Solution
Opt
==
null
)
{
await
context
.
ReportMessageAsync
(
EditorFeaturesResources
.
Cannot_navigate_to_the_symbol_under_the_caret
).
ConfigureAwait
(
false
);
return
;
}
var
(
symbol
,
project
)
=
symbolAndProjectOpt
.
Value
;
var
solution
=
project
.
Solution
;
var
(
symbol
,
solution
)
=
symbolAndSolutionOpt
.
Value
;
var
bases
=
FindBaseHelpers
.
FindBases
(
symbol
,
project
,
cancellationToken
);
symbol
,
solution
,
cancellationToken
);
await
context
.
SetSearchTitleAsync
(
string
.
Format
(
EditorFeaturesResources
.
_0_bases
,
...
...
@@ -48,8 +47,7 @@ public async Task FindBasesAsync(Document document, int position, IFindUsagesCon
if
(
sourceDefinition
!=
null
)
{
var
definitionItem
=
await
sourceDefinition
.
ToClassifiedDefinitionItemAsync
(
solution
.
GetOriginatingProject
(
sourceDefinition
),
includeHiddenLocations
:
false
,
FindReferencesSearchOptions
.
Default
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
solution
,
includeHiddenLocations
:
false
,
FindReferencesSearchOptions
.
Default
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
await
context
.
OnDefinitionFoundAsync
(
definitionItem
).
ConfigureAwait
(
false
);
found
=
true
;
...
...
@@ -57,7 +55,7 @@ public async Task FindBasesAsync(Document document, int position, IFindUsagesCon
else
if
(
baseSymbol
.
Locations
.
Any
(
l
=>
l
.
IsInMetadata
))
{
var
definitionItem
=
baseSymbol
.
ToNonClassifiedDefinitionItem
(
project
,
includeHiddenLocations
:
true
);
solution
,
includeHiddenLocations
:
true
);
await
context
.
OnDefinitionFoundAsync
(
definitionItem
).
ConfigureAwait
(
false
);
found
=
true
;
}
...
...
src/EditorFeatures/Core/GoToBase/FindBaseHelpers.cs
浏览文件 @
bbe1d6b2
...
...
@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Editor.GoToBase
internal
static
class
FindBaseHelpers
{
public
static
ImmutableArray
<
ISymbol
>
FindBases
(
ISymbol
symbol
,
Project
project
,
CancellationToken
cancellationToken
)
ISymbol
symbol
,
Solution
solution
,
CancellationToken
cancellationToken
)
{
if
(
symbol
is
INamedTypeSymbol
namedTypeSymbol
&&
(
namedTypeSymbol
.
TypeKind
==
TypeKind
.
Class
||
...
...
@@ -24,8 +24,7 @@ internal static class FindBaseHelpers
symbol
.
Kind
==
SymbolKind
.
Method
||
symbol
.
Kind
==
SymbolKind
.
Event
)
{
return
BaseTypeFinder
.
FindOverriddenAndImplementedMembers
(
symbol
,
project
,
cancellationToken
);
return
BaseTypeFinder
.
FindOverriddenAndImplementedMembers
(
symbol
,
solution
,
cancellationToken
);
}
else
{
...
...
src/EditorFeatures/Core/GoToDefinition/AbstractGoToDefinitionService.cs
浏览文件 @
bbe1d6b2
...
...
@@ -63,7 +63,7 @@ public bool TryGoToDefinition(Document document, int position, CancellationToken
var
isThirdPartyNavigationAllowed
=
IsThirdPartyNavigationAllowed
(
symbol
,
position
,
document
,
cancellationToken
);
return
GoToDefinitionHelpers
.
TryGoToDefinition
(
symbol
,
document
.
Project
,
document
.
Project
.
Solution
,
_streamingPresenter
.
Value
,
thirdPartyNavigationAllowed
:
isThirdPartyNavigationAllowed
,
cancellationToken
:
cancellationToken
);
...
...
@@ -100,7 +100,7 @@ public bool TryGoToDefinition(Document document, int position, CancellationToken
var
definitions
=
interfaceImpls
.
SelectMany
(
i
=>
GoToDefinitionHelpers
.
GetDefinitions
(
i
,
project
,
thirdPartyNavigationAllowed
:
false
,
cancellationToken
)).
ToImmutableArray
();
i
,
solution
,
thirdPartyNavigationAllowed
:
false
,
cancellationToken
)).
ToImmutableArray
();
var
title
=
string
.
Format
(
EditorFeaturesResources
.
_0_implemented_members
,
FindUsagesHelpers
.
GetDisplayName
(
symbol
));
...
...
src/EditorFeatures/Core/GoToDefinition/AbstractGoToSymbolService.cs
浏览文件 @
bbe1d6b2
...
...
@@ -40,8 +40,9 @@ public async Task GetSymbolsAsync(GoToSymbolContext context)
await
ThreadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
(
alwaysYield
:
true
,
cancellationToken
);
cancellationToken
.
ThrowIfCancellationRequested
();
var
definitions
=
GoToDefinitionHelpers
.
GetDefinitions
(
symbol
,
document
.
Project
,
thirdPartyNavigationAllowed
:
true
,
cancellationToken
)
.
WhereAsArray
(
d
=>
d
.
CanNavigateTo
(
document
.
Project
.
Solution
.
Workspace
));
var
solution
=
document
.
Project
.
Solution
;
var
definitions
=
GoToDefinitionHelpers
.
GetDefinitions
(
symbol
,
solution
,
thirdPartyNavigationAllowed
:
true
,
cancellationToken
)
.
WhereAsArray
(
d
=>
d
.
CanNavigateTo
(
solution
.
Workspace
));
await
TaskScheduler
.
Default
;
...
...
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionHelpers.cs
浏览文件 @
bbe1d6b2
...
...
@@ -20,7 +20,7 @@ internal static class GoToDefinitionHelpers
{
public
static
ImmutableArray
<
DefinitionItem
>
GetDefinitions
(
ISymbol
symbol
,
Project
project
,
Solution
solution
,
bool
thirdPartyNavigationAllowed
,
CancellationToken
cancellationToken
)
{
...
...
@@ -36,13 +36,12 @@ internal static class GoToDefinitionHelpers
// VB global import aliases have a synthesized SyntaxTree.
// We can't go to the definition of the alias, so use the target type.
var
solution
=
project
.
Solution
;
if
(
alias
!=
null
)
{
var
sourceLocations
=
NavigableItemFactory
.
GetPreferredSourceLocations
(
solution
,
symbol
,
cancellationToken
);
if
(
sourceLocations
.
All
(
l
=>
project
.
S
olution
.
GetDocument
(
l
.
SourceTree
)
==
null
))
if
(
sourceLocations
.
All
(
l
=>
s
olution
.
GetDocument
(
l
.
SourceTree
)
==
null
))
{
symbol
=
alias
.
Target
;
}
...
...
@@ -81,7 +80,7 @@ internal static class GoToDefinitionHelpers
// So, if we only have a single location to go to, this does no unnecessary work. And,
// if we do have multiple locations to show, it will just be done in the BG, unblocking
// this command thread so it can return the user faster.
var
definitionItem
=
symbol
.
ToNonClassifiedDefinitionItem
(
project
,
includeHiddenLocations
:
true
);
var
definitionItem
=
symbol
.
ToNonClassifiedDefinitionItem
(
solution
,
includeHiddenLocations
:
true
);
if
(
thirdPartyNavigationAllowed
)
{
...
...
@@ -96,23 +95,23 @@ internal static class GoToDefinitionHelpers
public
static
bool
TryGoToDefinition
(
ISymbol
symbol
,
Project
project
,
Solution
solution
,
IStreamingFindUsagesPresenter
streamingPresenter
,
CancellationToken
cancellationToken
,
bool
thirdPartyNavigationAllowed
=
true
)
{
var
definitions
=
GetDefinitions
(
symbol
,
project
,
thirdPartyNavigationAllowed
,
cancellationToken
);
var
definitions
=
GetDefinitions
(
symbol
,
solution
,
thirdPartyNavigationAllowed
,
cancellationToken
);
var
title
=
string
.
Format
(
EditorFeaturesResources
.
_0_declarations
,
FindUsagesHelpers
.
GetDisplayName
(
symbol
));
return
streamingPresenter
.
TryNavigateToOrPresentItemsAsync
(
project
.
S
olution
.
Workspace
,
title
,
definitions
).
WaitAndGetResult
(
cancellationToken
);
s
olution
.
Workspace
,
title
,
definitions
).
WaitAndGetResult
(
cancellationToken
);
}
public
static
bool
TryGoToDefinition
(
ImmutableArray
<
DefinitionItem
>
definitions
,
Project
project
,
Solution
solution
,
string
title
,
IStreamingFindUsagesPresenter
streamingPresenter
,
CancellationToken
cancellationToken
)
...
...
@@ -123,7 +122,7 @@ internal static class GoToDefinitionHelpers
}
return
streamingPresenter
.
TryNavigateToOrPresentItemsAsync
(
project
.
S
olution
.
Workspace
,
title
,
definitions
).
WaitAndGetResult
(
cancellationToken
);
s
olution
.
Workspace
,
title
,
definitions
).
WaitAndGetResult
(
cancellationToken
);
}
}
}
src/EditorFeatures/Core/Implementation/IntelliSense/Helpers.cs
浏览文件 @
bbe1d6b2
...
...
@@ -168,7 +168,7 @@ private static void NavigateToQuickInfoTarget(string navigationTarget, Document
if
(
resolvedSymbolKey
.
GetAnySymbol
()
is
{
}
symbol
)
{
GoToDefinitionHelpers
.
TryGoToDefinition
(
symbol
,
document
.
Project
,
streamingPresenter
,
CancellationToken
.
None
);
GoToDefinitionHelpers
.
TryGoToDefinition
(
symbol
,
document
.
Project
.
Solution
,
streamingPresenter
,
CancellationToken
.
None
);
return
;
}
}
...
...
src/EditorFeatures/Core/Implementation/Peek/PeekableItemFactory.cs
浏览文件 @
bbe1d6b2
...
...
@@ -62,7 +62,7 @@ public PeekableItemFactory(IMetadataAsSourceFileService metadataAsSourceFileServ
}
var
symbolNavigationService
=
solution
.
Workspace
.
Services
.
GetService
<
ISymbolNavigationService
>();
var
definitionItem
=
symbol
.
ToNonClassifiedDefinitionItem
(
project
,
includeHiddenLocations
:
true
);
var
definitionItem
=
symbol
.
ToNonClassifiedDefinitionItem
(
solution
,
includeHiddenLocations
:
true
);
if
(
symbolNavigationService
.
WouldNavigateToSymbol
(
definitionItem
,
solution
,
cancellationToken
,
...
...
src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.NavigableSymbol.cs
浏览文件 @
bbe1d6b2
...
...
@@ -52,7 +52,7 @@ private class NavigableSymbol : INavigableSymbol
showProgress
:
false
,
action
:
context
=>
GoToDefinitionHelpers
.
TryGoToDefinition
(
_definitions
,
_document
.
Project
,
_document
.
Project
.
Solution
,
_definitions
[
0
].
NameDisplayParts
.
GetFullText
(),
_presenter
,
context
.
CancellationToken
)
...
...
src/Features/Core/Portable/FindUsages/DefinitionItem.cs
浏览文件 @
bbe1d6b2
...
...
@@ -213,7 +213,7 @@ internal abstract partial class DefinitionItem
ImmutableArray
<
string
>
tags
,
ImmutableArray
<
TaggedText
>
displayParts
,
ImmutableArray
<
TaggedText
>
nameDisplayParts
,
Project
project
,
Solution
solution
,
ISymbol
symbol
,
ImmutableDictionary
<
string
,
string
>
properties
=
null
,
bool
displayIfNoReferences
=
true
)
...
...
@@ -222,9 +222,12 @@ internal abstract partial class DefinitionItem
var
symbolKey
=
symbol
.
GetSymbolKey
().
ToString
();
var
projectId
=
solution
.
GetOriginatingProjectId
(
symbol
);
Contract
.
ThrowIfNull
(
projectId
);
properties
=
properties
.
Add
(
MetadataSymbolKey
,
symbolKey
)
.
Add
(
MetadataSymbolOriginatingProjectIdGuid
,
project
.
Id
.
Id
.
ToString
())
.
Add
(
MetadataSymbolOriginatingProjectIdDebugName
,
project
.
Id
.
DebugName
);
.
Add
(
MetadataSymbolOriginatingProjectIdGuid
,
projectId
.
Id
.
ToString
())
.
Add
(
MetadataSymbolOriginatingProjectIdDebugName
,
projectId
.
DebugName
);
var
originationParts
=
GetOriginationParts
(
symbol
);
return
new
DefaultDefinitionItem
(
...
...
src/Tools/ExternalAccess/Debugger/DebuggerFindReferencesService.cs
浏览文件 @
bbe1d6b2
...
...
@@ -39,7 +39,8 @@ public async Task FindSymbolReferencesAsync(ISymbol symbol, Project project, Can
// the context object that the FAR service will push results into.
var
context
=
streamingPresenter
.
StartSearch
(
EditorFeaturesResources
.
Find_References
,
supportsReferences
:
true
);
await
AbstractFindUsagesService
.
FindSymbolReferencesAsync
(
_threadingContext
,
context
,
symbol
,
project
,
cancellationToken
).
ConfigureAwait
(
false
);
await
AbstractFindUsagesService
.
FindSymbolReferencesAsync
(
_threadingContext
,
context
,
symbol
,
project
.
Solution
,
cancellationToken
).
ConfigureAwait
(
false
);
// Note: we don't need to put this in a finally. The only time we might not hit
// this is if cancellation or another error gets thrown. In the former case,
...
...
src/VisualStudio/Core/Def/Implementation/Library/ObjectBrowser/AbstractObjectBrowserLibraryManager.cs
浏览文件 @
bbe1d6b2
...
...
@@ -553,8 +553,7 @@ private static async Task FindReferencesAsync(IThreadingContext threadingContext
if
(
symbol
!=
null
)
{
await
AbstractFindUsagesService
.
FindSymbolReferencesAsync
(
threadingContext
,
context
,
symbol
,
project
,
cancellationToken
).
ConfigureAwait
(
false
);
threadingContext
,
context
,
symbol
,
project
.
Solution
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
...
...
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioSymbolNavigationService.cs
浏览文件 @
bbe1d6b2
...
...
@@ -178,14 +178,14 @@ public bool TryNavigateToSymbol(ISymbol symbol, Project project, OptionSet optio
}
public
bool
TrySymbolNavigationNotify
(
ISymbol
symbol
,
Project
project
,
CancellationToken
cancellationToken
)
=>
TryNotifyForSpecificSymbol
(
symbol
,
project
,
cancellationToken
);
=>
TryNotifyForSpecificSymbol
(
symbol
,
project
.
Solution
,
cancellationToken
);
private
bool
TryNotifyForSpecificSymbol
(
ISymbol
symbol
,
Project
project
,
CancellationToken
cancellationToken
)
ISymbol
symbol
,
Solution
solution
,
CancellationToken
cancellationToken
)
{
AssertIsForeground
();
var
definitionItem
=
symbol
.
ToNonClassifiedDefinitionItem
(
project
,
includeHiddenLocations
:
true
);
var
definitionItem
=
symbol
.
ToNonClassifiedDefinitionItem
(
solution
,
includeHiddenLocations
:
true
);
definitionItem
.
Properties
.
TryGetValue
(
DefinitionItem
.
RQNameKey1
,
out
var
rqName
);
if
(!
TryGetNavigationAPIRequiredArguments
(
...
...
src/VisualStudio/Core/Impl/RoslynVisualStudioWorkspace.cs
浏览文件 @
bbe1d6b2
...
...
@@ -122,7 +122,7 @@ internal override IInvisibleEditor OpenInvisibleEditor(DocumentId documentId)
}
return
GoToDefinitionHelpers
.
TryGoToDefinition
(
searchSymbol
,
searchProject
,
searchSymbol
,
searchProject
.
Solution
,
_streamingPresenter
.
Value
,
cancellationToken
);
}
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/BaseTypeFinder.cs
浏览文件 @
bbe1d6b2
...
...
@@ -15,9 +15,8 @@ public static ImmutableArray<ISymbol> FindBaseTypesAndInterfaces(INamedTypeSymbo
=>
FindBaseTypes
(
type
).
AddRange
(
type
.
AllInterfaces
).
CastArray
<
ISymbol
>();
public
static
ImmutableArray
<
ISymbol
>
FindOverriddenAndImplementedMembers
(
ISymbol
symbol
,
Project
project
,
CancellationToken
cancellationToken
)
ISymbol
symbol
,
Solution
solution
,
CancellationToken
cancellationToken
)
{
var
solution
=
project
.
Solution
;
var
results
=
ArrayBuilder
<
ISymbol
>.
GetInstance
();
// This is called for all: class, struct or interface member.
...
...
src/Workspaces/CoreTest/FindReferencesTests.cs
浏览文件 @
bbe1d6b2
...
...
@@ -325,7 +325,7 @@ public System.Uri Get()
var
projectIds
=
new
HashSet
<
ProjectId
>();
foreach
(
var
r
in
references
)
projectIds
.
Add
(
solution
.
Get
Exact
ProjectId
(
r
.
Definition
));
projectIds
.
Add
(
solution
.
Get
Originating
ProjectId
(
r
.
Definition
));
Assert
.
True
(
projectIds
.
Contains
(
desktopProject
.
Id
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录