Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5de0b845
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,发现更多精彩内容 >>
提交
5de0b845
编写于
11月 12, 2019
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address some more feedback
上级
3a6892d2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
15 deletion
+21
-15
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
...onCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
+18
-11
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
...olutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
+2
-3
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs
...Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs
+1
-1
未找到文件。
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
浏览文件 @
5de0b845
...
...
@@ -18,7 +18,6 @@
using
Microsoft.CodeAnalysis.Notification
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Shared.Options
;
using
Microsoft.CodeAnalysis.Shared.TestHooks
;
using
Roslyn.Utilities
;
...
...
@@ -41,6 +40,7 @@ private partial class IncrementalAnalyzerProcessor
private
readonly
NormalPriorityProcessor
_normalPriorityProcessor
;
private
readonly
LowPriorityProcessor
_lowPriorityProcessor
;
// NOTE: IDiagnosticAnalyzerService can be null in test environment.
private
readonly
Lazy
<
IDiagnosticAnalyzerService
?>
_lazyDiagnosticAnalyzerService
;
private
LogAggregator
_logAggregator
;
...
...
@@ -116,19 +116,19 @@ public void Enqueue(WorkItem item)
}
else
{
if
(
ShouldEnqueueReducedWorkItem
(
item
,
_highPriorityProcessor
.
Analyzers
,
options
,
analysisScope
,
out
var
reduced
WorkItem
))
if
(
TryGetItemWithOverriddenAnalysisScope
(
item
,
_highPriorityProcessor
.
Analyzers
,
options
,
analysisScope
,
out
var
new
WorkItem
))
{
_highPriorityProcessor
.
Enqueue
(
reduced
WorkItem
.
Value
);
_highPriorityProcessor
.
Enqueue
(
new
WorkItem
.
Value
);
}
if
(
ShouldEnqueueReducedWorkItem
(
item
,
_normalPriorityProcessor
.
Analyzers
,
options
,
analysisScope
,
out
reduced
WorkItem
))
if
(
TryGetItemWithOverriddenAnalysisScope
(
item
,
_normalPriorityProcessor
.
Analyzers
,
options
,
analysisScope
,
out
new
WorkItem
))
{
_normalPriorityProcessor
.
Enqueue
(
reduced
WorkItem
.
Value
);
_normalPriorityProcessor
.
Enqueue
(
new
WorkItem
.
Value
);
}
if
(
ShouldEnqueueReducedWorkItem
(
item
,
_lowPriorityProcessor
.
Analyzers
,
options
,
analysisScope
,
out
reduced
WorkItem
))
if
(
TryGetItemWithOverriddenAnalysisScope
(
item
,
_lowPriorityProcessor
.
Analyzers
,
options
,
analysisScope
,
out
new
WorkItem
))
{
_lowPriorityProcessor
.
Enqueue
(
reduced
WorkItem
.
Value
);
_lowPriorityProcessor
.
Enqueue
(
new
WorkItem
.
Value
);
}
}
...
...
@@ -139,11 +139,18 @@ public void Enqueue(WorkItem item)
bool
ShouldEnqueueForAllQueues
(
WorkItem
item
,
BackgroundAnalysisScope
analysisScope
)
{
var
reasons
=
item
.
InvocationReasons
;
// For active file analysis scope we only process following:
// 1. Active documents
// 2. Closed and removed documents to ensure that data for removed and closed documents
// is no longer held in memory and removed from any user visible components.
// For example, this ensures that diagnostics for closed/removed documents are removed from error list.
// Note that we don't need to specially handle "Project removed" or "Project closed" case, as the solution crawler
// enqueues individual "DocumentRemoved" work items for each document in the removed project.
if
(
analysisScope
==
BackgroundAnalysisScope
.
ActiveFile
&&
!
reasons
.
Contains
(
PredefinedInvocationReasons
.
DocumentClosed
)
&&
!
reasons
.
Contains
(
PredefinedInvocationReasons
.
DocumentRemoved
))
{
// Only process active/closed/removed documents for active file analysis.
return
item
.
DocumentId
==
_documentTracker
.
TryGetActiveDocument
();
}
...
...
@@ -151,7 +158,7 @@ bool ShouldEnqueueForAllQueues(WorkItem item, BackgroundAnalysisScope analysisSc
}
}
private
static
bool
ShouldEnqueueReducedWorkItem
(
private
static
bool
TryGetItemWithOverriddenAnalysisScope
(
WorkItem
item
,
ImmutableArray
<
IIncrementalAnalyzer
>
allAnalyzers
,
OptionSet
options
,
...
...
@@ -254,7 +261,7 @@ private void ReportPendingWorkItemCount()
private
async
Task
RunAnalyzersAsync
<
T
>(
ImmutableArray
<
IIncrementalAnalyzer
>
analyzers
,
T
value
,
WorkItem
?
workItem
,
WorkItem
workItem
,
Func
<
IIncrementalAnalyzer
,
T
,
CancellationToken
,
Task
>
runnerAsync
,
CancellationToken
cancellationToken
)
{
...
...
@@ -263,7 +270,7 @@ private void ReportPendingWorkItemCount()
ReportPendingWorkItemCount
();
// Check if the work item is specific to some incremental analyzer(s).
var
analyzersToExecute
=
workItem
?
.
GetApplicableAnalyzers
(
analyzers
)
??
analyzers
;
var
analyzersToExecute
=
workItem
.
GetApplicableAnalyzers
(
analyzers
)
??
analyzers
;
foreach
(
var
analyzer
in
analyzersToExecute
)
{
if
(
cancellationToken
.
IsCancellationRequested
)
...
...
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
浏览文件 @
5de0b845
...
...
@@ -335,8 +335,7 @@ private async Task ProcessDocumentAsync(ImmutableArray<IIncrementalAnalyzer> ana
{
var
document
=
solution
.
GetDocument
(
documentId
);
if
(
document
!=
null
&&
!
workItem
.
InvocationReasons
.
Contains
(
PredefinedInvocationReasons
.
DocumentRemoved
))
if
(
document
!=
null
)
{
// if we are called because a document is opened, we invalidate the document so that
// it can be re-analyzed. otherwise, since newly opened document has same version as before
...
...
@@ -472,7 +471,7 @@ private async Task ResetStatesAsync()
return
;
}
await
Processor
.
RunAnalyzersAsync
(
Analyzers
,
Processor
.
CurrentSolution
,
workItem
:
n
ull
,
(
a
,
s
,
c
)
=>
a
.
NewSolutionSnapshotAsync
(
s
,
c
),
CancellationToken
).
ConfigureAwait
(
false
);
await
Processor
.
RunAnalyzersAsync
(
Analyzers
,
Processor
.
CurrentSolution
,
workItem
:
n
ew
WorkItem
()
,
(
a
,
s
,
c
)
=>
a
.
NewSolutionSnapshotAsync
(
s
,
c
),
CancellationToken
).
ConfigureAwait
(
false
);
foreach
(
var
id
in
Processor
.
GetOpenDocumentIds
())
{
...
...
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs
浏览文件 @
5de0b845
...
...
@@ -40,7 +40,7 @@ private partial class WorkCoordinator
/// Otherwise, returns <paramref name="allAnalyzers"/>.
/// </summary>
public
IEnumerable
<
IIncrementalAnalyzer
>
GetApplicableAnalyzers
(
ImmutableArray
<
IIncrementalAnalyzer
>
allAnalyzers
)
=>
SpecificAnalyzers
.
Count
>
0
?
SpecificAnalyzers
.
Where
(
allAnalyzers
.
Contains
)
:
allAnalyzers
;
=>
SpecificAnalyzers
?
.
Count
>
0
?
SpecificAnalyzers
.
Where
(
allAnalyzers
.
Contains
)
:
allAnalyzers
;
// retry
public
readonly
bool
IsRetry
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录