Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3cd50f0c
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,发现更多精彩内容 >>
提交
3cd50f0c
编写于
3月 23, 2016
作者:
H
Heejae Chang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
made argsId to be shared between engine v1 and v2
上级
c632be8e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
50 deletion
+24
-50
src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.NestedTypes.cs
...ics/EngineV1/DiagnosticIncrementalAnalyzer.NestedTypes.cs
+0
-31
src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.cs
...ble/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.cs
+2
-9
src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs
.../EngineV1/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs
+9
-9
src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs
...s/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs
+13
-1
未找到文件。
src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.NestedTypes.cs
浏览文件 @
3cd50f0c
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Collections.Immutable
;
using
System.Linq
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.Diagnostics.EngineV1
{
...
...
@@ -82,33 +79,5 @@ public VersionArgument(VersionStamp textVersion, VersionStamp dataVersion, Versi
this
.
ProjectVersion
=
projectVersion
;
}
}
public
class
HostAnalyzerKey
:
ArgumentKey
{
private
readonly
string
_analyzerPackageName
;
public
HostAnalyzerKey
(
DiagnosticAnalyzer
analyzer
,
StateType
stateType
,
object
key
,
string
analyzerPackageName
)
:
base
(
analyzer
,
stateType
,
key
)
{
_analyzerPackageName
=
analyzerPackageName
;
}
public
override
string
BuildTool
{
get
{
return
_analyzerPackageName
;
}
}
}
public
class
ArgumentKey
:
LiveDiagnosticUpdateArgsId
{
public
ArgumentKey
(
DiagnosticAnalyzer
analyzer
,
StateType
stateType
,
object
key
)
:
base
(
analyzer
,
key
,
(
int
)
stateType
)
{
}
public
StateType
StateType
=>
(
StateType
)
Kind
;
}
}
}
src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.cs
浏览文件 @
3cd50f0c
...
...
@@ -823,7 +823,7 @@ private static ImmutableArray<DiagnosticData> GetDiagnosticData(ILookup<Document
StateType
type
,
object
key
,
StateSet
stateSet
,
SolutionArgument
solution
,
ImmutableArray
<
DiagnosticData
>
diagnostics
,
Action
<
DiagnosticsUpdatedArgs
>
raiseEvents
)
{
// get right arg id for the given analyzer
var
id
=
CreateArgumentKey
(
type
,
key
,
stateSet
);
var
id
=
new
LiveDiagnosticUpdateArgsId
(
stateSet
.
Analyzer
,
key
,
(
int
)
type
,
stateSet
.
ErrorSourceName
);
raiseEvents
(
DiagnosticsUpdatedArgs
.
DiagnosticsCreated
(
id
,
Workspace
,
solution
.
Solution
,
solution
.
ProjectId
,
solution
.
DocumentId
,
diagnostics
));
}
...
...
@@ -837,7 +837,7 @@ private static ImmutableArray<DiagnosticData> GetDiagnosticData(ILookup<Document
StateType
type
,
object
key
,
StateSet
stateSet
,
SolutionArgument
solution
,
Action
<
DiagnosticsUpdatedArgs
>
raiseEvents
)
{
// get right arg id for the given analyzer
var
id
=
CreateArgumentKey
(
type
,
key
,
stateSet
);
var
id
=
new
LiveDiagnosticUpdateArgsId
(
stateSet
.
Analyzer
,
key
,
(
int
)
type
,
stateSet
.
ErrorSourceName
);
raiseEvents
(
DiagnosticsUpdatedArgs
.
DiagnosticsRemoved
(
id
,
Workspace
,
solution
.
Solution
,
solution
.
ProjectId
,
solution
.
DocumentId
));
}
...
...
@@ -867,13 +867,6 @@ private void RaiseProjectDiagnosticsRemoved(Project project, IEnumerable<StateSe
}
}
private
static
ArgumentKey
CreateArgumentKey
(
StateType
type
,
object
key
,
StateSet
stateSet
)
{
return
stateSet
.
ErrorSourceName
!=
null
?
new
HostAnalyzerKey
(
stateSet
.
Analyzer
,
type
,
key
,
stateSet
.
ErrorSourceName
)
:
new
ArgumentKey
(
stateSet
.
Analyzer
,
type
,
key
);
}
private
ImmutableArray
<
DiagnosticData
>
UpdateDocumentDiagnostics
(
AnalysisData
existingData
,
ImmutableArray
<
TextSpan
>
range
,
ImmutableArray
<
DiagnosticData
>
memberDiagnostics
,
SyntaxTree
tree
,
SyntaxNode
member
,
int
memberId
)
...
...
src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs
浏览文件 @
3cd50f0c
...
...
@@ -295,7 +295,7 @@ public async Task<ImmutableArray<DiagnosticData>> GetSpecificDiagnosticsAsync(Ca
return
ImmutableArray
<
DiagnosticData
>.
Empty
;
}
var
key
=
Id
as
ArgumentKey
;
var
key
=
Id
as
LiveDiagnosticUpdateArgsId
;
if
(
key
==
null
)
{
return
ImmutableArray
<
DiagnosticData
>.
Empty
;
...
...
@@ -316,7 +316,7 @@ public async Task<ImmutableArray<DiagnosticData>> GetSpecificDiagnosticsAsync(Ca
return
ImmutableArray
<
DiagnosticData
>.
Empty
;
}
var
state
=
stateSet
.
GetState
(
key
.
StateType
);
var
state
=
stateSet
.
GetState
(
(
StateType
)
key
.
Kind
);
if
(
state
==
null
)
{
return
ImmutableArray
<
DiagnosticData
>.
Empty
;
...
...
@@ -584,7 +584,7 @@ public async Task<ImmutableArray<DiagnosticData>> GetSpecificDiagnosticsAsync(Ca
return
ImmutableArray
<
DiagnosticData
>.
Empty
;
}
var
key
=
Id
as
ArgumentKey
;
var
key
=
Id
as
LiveDiagnosticUpdateArgsId
;
if
(
key
==
null
)
{
return
ImmutableArray
<
DiagnosticData
>.
Empty
;
...
...
@@ -597,7 +597,7 @@ public async Task<ImmutableArray<DiagnosticData>> GetSpecificDiagnosticsAsync(Ca
return
ImmutableArray
<
DiagnosticData
>.
Empty
;
}
if
(
key
.
StateType
!=
StateType
.
Project
)
if
(
key
.
Kind
!=
(
int
)
StateType
.
Project
)
{
return
await
GetSpecificDiagnosticsAsync
(
documentOrProject
,
key
,
cancellationToken
).
ConfigureAwait
(
false
);
}
...
...
@@ -605,9 +605,9 @@ public async Task<ImmutableArray<DiagnosticData>> GetSpecificDiagnosticsAsync(Ca
return
await
GetSpecificDiagnosticsAsync
(
GetProject
(
documentOrProject
),
key
,
cancellationToken
).
ConfigureAwait
(
false
);
}
private
async
Task
<
ImmutableArray
<
DiagnosticData
>>
GetSpecificDiagnosticsAsync
(
object
documentOrProject
,
ArgumentKey
key
,
CancellationToken
cancellationToken
)
private
async
Task
<
ImmutableArray
<
DiagnosticData
>>
GetSpecificDiagnosticsAsync
(
object
documentOrProject
,
LiveDiagnosticUpdateArgsId
key
,
CancellationToken
cancellationToken
)
{
var
versions
=
await
GetVersionsAsync
(
documentOrProject
,
key
.
StateType
,
cancellationToken
).
ConfigureAwait
(
false
);
var
versions
=
await
GetVersionsAsync
(
documentOrProject
,
(
StateType
)
key
.
Kind
,
cancellationToken
).
ConfigureAwait
(
false
);
var
project
=
GetProject
(
documentOrProject
);
var
stateSet
=
this
.
StateManager
.
GetOrCreateStateSet
(
project
,
key
.
Analyzer
);
...
...
@@ -617,10 +617,10 @@ private async Task<ImmutableArray<DiagnosticData>> GetSpecificDiagnosticsAsync(o
}
var
analyzers
=
Owner
.
_stateManager
.
GetOrCreateAnalyzers
(
project
);
var
driver
=
await
GetDiagnosticAnalyzerDriverAsync
(
documentOrProject
,
analyzers
,
key
.
StateType
,
cancellationToken
).
ConfigureAwait
(
false
);
var
driver
=
await
GetDiagnosticAnalyzerDriverAsync
(
documentOrProject
,
analyzers
,
(
StateType
)
key
.
Kind
,
cancellationToken
).
ConfigureAwait
(
false
);
var
analysisData
=
await
GetDiagnosticAnalysisDataAsync
(
driver
,
stateSet
,
key
.
StateType
,
versions
).
ConfigureAwait
(
false
);
if
(
key
.
StateType
!=
StateType
.
Project
)
var
analysisData
=
await
GetDiagnosticAnalysisDataAsync
(
driver
,
stateSet
,
(
StateType
)
key
.
Kind
,
versions
).
ConfigureAwait
(
false
);
if
(
key
.
Kind
!=
(
int
)
StateType
.
Project
)
{
return
analysisData
.
Items
;
}
...
...
src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs
浏览文件 @
3cd50f0c
...
...
@@ -6,15 +6,27 @@ namespace Microsoft.CodeAnalysis.Diagnostics
{
internal
class
LiveDiagnosticUpdateArgsId
:
AnalyzerUpdateArgsId
{
private
readonly
string
_analyzerPackageName
;
public
readonly
object
Key
;
public
readonly
int
Kind
;
public
LiveDiagnosticUpdateArgsId
(
DiagnosticAnalyzer
analyzer
,
object
key
,
int
kind
)
:
base
(
analyzer
)
public
LiveDiagnosticUpdateArgsId
(
DiagnosticAnalyzer
analyzer
,
object
key
,
int
kind
)
:
this
(
analyzer
,
key
,
kind
,
analyzerPackageName
:
null
)
{
}
public
LiveDiagnosticUpdateArgsId
(
DiagnosticAnalyzer
analyzer
,
object
key
,
int
kind
,
string
analyzerPackageName
)
:
base
(
analyzer
)
{
Key
=
key
;
Kind
=
kind
;
_analyzerPackageName
=
analyzerPackageName
;
}
public
override
string
BuildTool
=>
_analyzerPackageName
??
base
.
BuildTool
;
public
override
bool
Equals
(
object
obj
)
{
var
other
=
obj
as
LiveDiagnosticUpdateArgsId
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录