Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3f91cca0
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,发现更多精彩内容 >>
提交
3f91cca0
编写于
2月 09, 2015
作者:
M
Matt Warren
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
4825e373
4f147f5b
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
110 addition
and
56 deletion
+110
-56
src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs
...pilers/CSharp/Portable/Compilation/MemberSemanticModel.cs
+2
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_StringInterpolation.cs
...wering/LocalRewriter/LocalRewriter_StringInterpolation.cs
+7
-1
src/Compilers/CSharp/Test/Semantic/Semantics/AwaitExpressionTests.cs
...rs/CSharp/Test/Semantic/Semantics/AwaitExpressionTests.cs
+18
-0
src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs
...lers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs
+24
-0
src/Compilers/Core/Desktop/FileKey.cs
src/Compilers/Core/Desktop/FileKey.cs
+1
-0
src/Compilers/Core/VBCSCompiler/MetadataCache.cs
src/Compilers/Core/VBCSCompiler/MetadataCache.cs
+4
-4
src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.DeclaredSymbolNavigableItem.cs
...ation/NavigableItemFactory.DeclaredSymbolNavigableItem.cs
+4
-2
src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.cs
...res/Core/Extensibility/Navigation/NavigableItemFactory.cs
+2
-3
src/EditorFeatures/Core/Implementation/NavigateTo/AbstractNavigateToSearchService.SearchResult.cs
...avigateTo/AbstractNavigateToSearchService.SearchResult.cs
+1
-1
src/EditorFeatures/Core/Implementation/NavigateTo/AbstractNavigateToSearchService.cs
...lementation/NavigateTo/AbstractNavigateToSearchService.cs
+3
-3
src/Roslyn.sln
src/Roslyn.sln
+39
-1
src/VisualStudio/Core/SolutionExplorerShim/AnalyzersCommandHandler.cs
...udio/Core/SolutionExplorerShim/AnalyzersCommandHandler.cs
+2
-40
src/VisualStudio/Core/SolutionExplorerShim/SolutionExplorerShim.csproj
...dio/Core/SolutionExplorerShim/SolutionExplorerShim.csproj
+3
-0
未找到文件。
src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs
浏览文件 @
3f91cca0
...
...
@@ -632,7 +632,8 @@ public override AwaitExpressionInfo GetAwaitExpressionInfo(AwaitExpressionSyntax
throw
new
ArgumentException
(
"node.Kind=="
+
node
.
Kind
());
}
BoundAwaitExpression
boundAwait
=
GetUpperBoundNode
(
node
)
as
BoundAwaitExpression
;
var
bound
=
GetUpperBoundNode
(
node
);
BoundAwaitExpression
boundAwait
=
((
bound
as
BoundExpressionStatement
)?.
Expression
??
bound
)
as
BoundAwaitExpression
;
if
(
boundAwait
==
null
)
{
return
default
(
AwaitExpressionInfo
);
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_StringInterpolation.cs
浏览文件 @
3f91cca0
...
...
@@ -64,7 +64,13 @@ private void MakeInterpolatedStringFormat(BoundInterpolatedString node, out Boun
formatString
.
Builder
.
Append
(
":"
).
Append
(
fillin
.
Format
.
ConstantValue
.
StringValue
);
}
formatString
.
Builder
.
Append
(
"}"
);
expressions
.
Add
(
fillin
.
Value
);
// NOTE: must still be lowered
var
value
=
fillin
.
Value
;
if
(
value
.
Type
?.
TypeKind
==
TypeKind
.
Dynamic
)
{
value
=
MakeConversion
(
value
,
_compilation
.
ObjectType
,
@checked
:
false
);
}
expressions
.
Add
(
value
);
// NOTE: must still be lowered
}
}
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/AwaitExpressionTests.cs
浏览文件 @
3f91cca0
...
...
@@ -35,6 +35,24 @@ async void Foo(Task<int> t)
Assert
.
Equal
(
"System.Boolean System.Runtime.CompilerServices.TaskAwaiter<System.Int32>.IsCompleted { get; }"
,
info
.
IsCompletedProperty
.
ToTestDisplayString
());
}
[
Fact
]
[
WorkItem
(
1084696
,
"DevDiv"
)]
public
void
TestAwaitInfo2
()
{
var
text
=
@"using System;
using System.Threading.Tasks;
public class C {
public C(Task<int> t) {
Func<Task> f = async() => await t;
}
}"
;
var
info
=
GetAwaitExpressionInfo
(
text
);
Assert
.
Equal
(
"System.Runtime.CompilerServices.TaskAwaiter<System.Int32> System.Threading.Tasks.Task<System.Int32>.GetAwaiter()"
,
info
.
GetAwaiterMethod
.
ToTestDisplayString
());
Assert
.
Equal
(
"System.Int32 System.Runtime.CompilerServices.TaskAwaiter<System.Int32>.GetResult()"
,
info
.
GetResultMethod
.
ToTestDisplayString
());
Assert
.
Equal
(
"System.Boolean System.Runtime.CompilerServices.TaskAwaiter<System.Int32>.IsCompleted { get; }"
,
info
.
IsCompletedProperty
.
ToTestDisplayString
());
}
private
AwaitExpressionInfo
GetAwaitExpressionInfo
(
string
text
,
params
DiagnosticDescription
[]
diagnostics
)
{
var
tree
=
Parse
(
text
,
options
:
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
CSharp5
));
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs
浏览文件 @
3f91cca0
...
...
@@ -248,6 +248,30 @@ static void Main(string[] args)
CompileAndVerify
(
source
,
expectedOutput
:
expectedOutput
);
}
[
Fact
,
WorkItem
(
306
),
WorkItem
(
308
)]
public
void
DynamicInterpolation
()
{
string
source
=
@"using System;
using System.Linq.Expressions;
class Program
{
static void Main(string[] args)
{
dynamic nil = null;
dynamic a = new string[] {""Hello"", ""world""};
Console.WriteLine($""<{nil}>"");
Console.WriteLine($""<{a}>"");
}
Expression<Func<string>> M(dynamic d) {
return () => $""Dynamic: {d}"";
}
}"
;
string
expectedOutput
=
@"<>
<System.String[]>"
;
var
verifier
=
CompileAndVerify
(
source
,
new
[]
{
SystemCoreRef
,
CSharpRef
},
expectedOutput
:
expectedOutput
).
VerifyDiagnostics
();
}
[
Fact
]
public
void
UnclosedInterpolation01
()
{
...
...
src/Compilers/Core/Desktop/FileKey.cs
浏览文件 @
3f91cca0
...
...
@@ -26,6 +26,7 @@ internal struct FileKey : IEquatable<FileKey>
public
FileKey
(
string
fullPath
,
DateTime
timestamp
)
{
Debug
.
Assert
(
PathUtilities
.
IsAbsolute
(
fullPath
));
Debug
.
Assert
(
timestamp
.
Kind
==
DateTimeKind
.
Utc
);
FullPath
=
fullPath
;
Timestamp
=
timestamp
;
...
...
src/Compilers/Core/VBCSCompiler/MetadataCache.cs
浏览文件 @
3f91cca0
...
...
@@ -83,9 +83,9 @@ internal Metadata GetMetadata(string fullPath, MetadataReferenceProperties prope
}
/// <summary>
/// A unique file key encapsulates a file path, and change date
as
/// hat can be used as the key to a dictionary.
/// If a file hasn't changed name or
change date
, we assume
/// A unique file key encapsulates a file path, and change date
///
t
hat can be used as the key to a dictionary.
/// If a file hasn't changed name or
timestamp
, we assume
/// it is unchanged.
///
/// Returns null if the file doesn't exist or otherwise can't be accessed.
...
...
@@ -104,7 +104,7 @@ internal Metadata GetMetadata(string fullPath, MetadataReferenceProperties prope
}
else
{
return
new
FileKey
(
fileInfo
.
FullName
,
fileInfo
.
LastWriteTime
);
return
new
FileKey
(
fileInfo
.
FullName
,
fileInfo
.
LastWriteTime
Utc
);
}
}
catch
(
Exception
)
...
...
src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.DeclaredSymbolNavigableItem.cs
浏览文件 @
3f91cca0
...
...
@@ -23,12 +23,14 @@ internal class DeclaredSymbolNavigableItem : INavigableItem
private
readonly
Lazy
<
string
>
_lazyDisplayName
;
private
readonly
Lazy
<
ISymbol
>
_lazySymbol
;
public
DeclaredSymbolNavigableItem
(
Document
document
,
DeclaredSymbolInfo
declaredSymbolInfo
,
CancellationToken
cancellationToken
)
public
DeclaredSymbolNavigableItem
(
Document
document
,
DeclaredSymbolInfo
declaredSymbolInfo
)
{
Document
=
document
;
_declaredSymbolInfo
=
declaredSymbolInfo
;
_lazySymbol
=
new
Lazy
<
ISymbol
>(()
=>
declaredSymbolInfo
.
GetSymbolAsync
(
document
,
cancellationToken
).
ConfigureAwait
(
false
).
GetAwaiter
().
GetResult
());
// Cancellation isn't supported when computing the various properties that depend on the symbol, hence
// CancellationToken.None.
_lazySymbol
=
new
Lazy
<
ISymbol
>(()
=>
declaredSymbolInfo
.
GetSymbolAsync
(
document
,
CancellationToken
.
None
).
ConfigureAwait
(
false
).
GetAwaiter
().
GetResult
());
_lazyDisplayName
=
new
Lazy
<
string
>(()
=>
{
if
(
Symbol
==
null
)
...
...
src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.cs
浏览文件 @
3f91cca0
...
...
@@ -2,7 +2,6 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.FindSymbols
;
using
Microsoft.CodeAnalysis.GeneratedCodeRecognition
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
...
...
@@ -17,9 +16,9 @@ public static INavigableItem GetItemFromSymbolLocation(Solution solution, ISymbo
return
new
SymbolLocationNavigableItem
(
solution
,
symbol
,
location
);
}
public
static
INavigableItem
GetItemFromDeclaredSymbolInfo
(
DeclaredSymbolInfo
declaredSymbolInfo
,
Document
document
,
CancellationToken
cancellationToken
)
public
static
INavigableItem
GetItemFromDeclaredSymbolInfo
(
DeclaredSymbolInfo
declaredSymbolInfo
,
Document
document
)
{
return
new
DeclaredSymbolNavigableItem
(
document
,
declaredSymbolInfo
,
cancellationToken
);
return
new
DeclaredSymbolNavigableItem
(
document
,
declaredSymbolInfo
);
}
public
static
IEnumerable
<
INavigableItem
>
GetItemsfromPreferredSourceLocations
(
Solution
solution
,
ISymbol
symbol
)
...
...
src/EditorFeatures/Core/Implementation/NavigateTo/AbstractNavigateToSearchService.SearchResult.cs
浏览文件 @
3f91cca0
...
...
@@ -41,7 +41,7 @@ public SearchResult(Document document, DeclaredSymbolInfo declaredSymbolInfo, st
var
declaredNavigableItem
=
navigableItem
as
NavigableItemFactory
.
DeclaredSymbolNavigableItem
;
Debug
.
Assert
(
declaredNavigableItem
!=
null
);
_lazySummary
=
new
Lazy
<
string
>(()
=>
declaredNavigableItem
.
Symbol
.
GetDocumentationComment
()?.
SummaryText
);
_lazySummary
=
new
Lazy
<
string
>(()
=>
declaredNavigableItem
.
Symbol
?
.
GetDocumentationComment
()?.
SummaryText
);
_lazyAdditionalInfo
=
new
Lazy
<
string
>(()
=>
{
switch
(
declaredSymbolInfo
.
Kind
)
...
...
src/EditorFeatures/Core/Implementation/NavigateTo/AbstractNavigateToSearchService.cs
浏览文件 @
3f91cca0
...
...
@@ -17,10 +17,10 @@ internal abstract partial class AbstractNavigateToSearchService : INavigateToSea
public
async
Task
<
IEnumerable
<
INavigateToSearchResult
>>
SearchProjectAsync
(
Project
project
,
string
searchPattern
,
CancellationToken
cancellationToken
)
{
var
results
=
await
NavigateToSymbolFinder
.
FindNavigableDeclaredSymbolInfos
(
project
,
searchPattern
,
cancellationToken
).
ConfigureAwait
(
false
);
return
results
.
Select
(
r
=>
ConvertResult
(
r
,
cancellationToken
));
return
results
.
Select
(
r
=>
ConvertResult
(
r
));
}
private
INavigateToSearchResult
ConvertResult
(
ValueTuple
<
DeclaredSymbolInfo
,
Document
,
IEnumerable
<
PatternMatch
>>
result
,
CancellationToken
cancellationToken
)
private
INavigateToSearchResult
ConvertResult
(
ValueTuple
<
DeclaredSymbolInfo
,
Document
,
IEnumerable
<
PatternMatch
>>
result
)
{
var
declaredSymbolInfo
=
result
.
Item1
;
var
document
=
result
.
Item2
;
...
...
@@ -31,7 +31,7 @@ private INavigateToSearchResult ConvertResult(ValueTuple<DeclaredSymbolInfo, Doc
// case sensitive.
var
isCaseSensitive
=
matches
.
All
(
m
=>
m
.
IsCaseSensitive
);
var
kind
=
GetItemKind
(
declaredSymbolInfo
);
var
navigableItem
=
NavigableItemFactory
.
GetItemFromDeclaredSymbolInfo
(
declaredSymbolInfo
,
document
,
cancellationToken
);
var
navigableItem
=
NavigableItemFactory
.
GetItemFromDeclaredSymbolInfo
(
declaredSymbolInfo
,
document
);
return
new
SearchResult
(
document
,
declaredSymbolInfo
,
kind
,
matchKind
,
isCaseSensitive
,
navigableItem
);
}
...
...
src/Roslyn.sln
浏览文件 @
3f91cca0
...
...
@@ -281,14 +281,26 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualStudio", "VisualStudi
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Diagnostics", "Diagnostics", "{5F5DD61A-746D-40AE-A89C-EF82B39C036E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeAnalysis", "CodeAnalysis", "{2344BE45-7F6B-4A4E-9418-567FA2D9CA8C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisDiagnosticAnalyzers", "Diagnostics\CodeAnalysis\Core\CodeAnalysisDiagnosticAnalyzers.csproj", "{D8762A0A-3832-47BE-BCF6-8B1060BE6B28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpCodeAnalysisDiagnosticAnalyzers", "Diagnostics\CodeAnalysis\CSharp\CSharpCodeAnalysisDiagnosticAnalyzers.csproj", "{921B412A-5551-4853-82B4-46AD5A05A03E}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BasicCodeAnalysisDiagnosticAnalyzers", "Diagnostics\CodeAnalysis\VisualBasic\BasicCodeAnalysisDiagnosticAnalyzers.vbproj", "{B1A6A74B-E484-48FB-8745-7A30A06DB631}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisDiagnosticAnalyzersTest", "Diagnostics\CodeAnalysis\Test\CodeAnalysisDiagnosticAnalyzersTest.csproj", "{0C2925AD-CD97-46FA-A686-E2C1AD19DAD8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisDiagnosticsSetup", "Diagnostics\CodeAnalysis\Setup\CodeAnalysisDiagnosticsSetup.csproj", "{54F6AE18-B0CD-4799-9DF0-9B1AAD6A78AF}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 4
Compilers\Core\SharedCollections\SharedCollections.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 4
Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 4
Compilers\Core\SharedCollections\SharedCollections.projitems*{afde6bea-5038-4a4a-a88e-dbd2e4088eed}*SharedItemsImports = 4
Compilers\Core\SharedCollections\SharedCollections.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 4
Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 4
Compilers\Core\SharedCollections\SharedCollections.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 4
Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 4
Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{b501a547-c911-4a05-ac6e-274a50dff30e}*SharedItemsImports = 4
Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 4
...
...
@@ -770,6 +782,26 @@ Global
{BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D8762A0A-3832-47BE-BCF6-8B1060BE6B28}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D8762A0A-3832-47BE-BCF6-8B1060BE6B28}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D8762A0A-3832-47BE-BCF6-8B1060BE6B28}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D8762A0A-3832-47BE-BCF6-8B1060BE6B28}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{921B412A-5551-4853-82B4-46AD5A05A03E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{921B412A-5551-4853-82B4-46AD5A05A03E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{921B412A-5551-4853-82B4-46AD5A05A03E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{921B412A-5551-4853-82B4-46AD5A05A03E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B1A6A74B-E484-48FB-8745-7A30A06DB631}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B1A6A74B-E484-48FB-8745-7A30A06DB631}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B1A6A74B-E484-48FB-8745-7A30A06DB631}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B1A6A74B-E484-48FB-8745-7A30A06DB631}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{0C2925AD-CD97-46FA-A686-E2C1AD19DAD8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{0C2925AD-CD97-46FA-A686-E2C1AD19DAD8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{0C2925AD-CD97-46FA-A686-E2C1AD19DAD8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{0C2925AD-CD97-46FA-A686-E2C1AD19DAD8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{54F6AE18-B0CD-4799-9DF0-9B1AAD6A78AF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{54F6AE18-B0CD-4799-9DF0-9B1AAD6A78AF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{54F6AE18-B0CD-4799-9DF0-9B1AAD6A78AF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{54F6AE18-B0CD-4799-9DF0-9B1AAD6A78AF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
@@ -899,5 +931,11 @@ Global
{5002636A-FE8D-40BF-8818-AB513A2194FA} = {235A3418-A3B0-4844-BCEB-F1CF45069232}
{ABDBAC1E-350E-4DC3-BB45-3504404545EE} = {235A3418-A3B0-4844-BCEB-F1CF45069232}
{BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0} = {235A3418-A3B0-4844-BCEB-F1CF45069232}
{2344BE45-7F6B-4A4E-9418-567FA2D9CA8C} = {5F5DD61A-746D-40AE-A89C-EF82B39C036E}
{D8762A0A-3832-47BE-BCF6-8B1060BE6B28} = {2344BE45-7F6B-4A4E-9418-567FA2D9CA8C}
{921B412A-5551-4853-82B4-46AD5A05A03E} = {2344BE45-7F6B-4A4E-9418-567FA2D9CA8C}
{B1A6A74B-E484-48FB-8745-7A30A06DB631} = {2344BE45-7F6B-4A4E-9418-567FA2D9CA8C}
{0C2925AD-CD97-46FA-A686-E2C1AD19DAD8} = {2344BE45-7F6B-4A4E-9418-567FA2D9CA8C}
{54F6AE18-B0CD-4799-9DF0-9B1AAD6A78AF} = {2344BE45-7F6B-4A4E-9418-567FA2D9CA8C}
EndGlobalSection
EndGlobal
src/VisualStudio/Core/SolutionExplorerShim/AnalyzersCommandHandler.cs
浏览文件 @
3f91cca0
...
...
@@ -13,6 +13,7 @@
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Editor.Host
;
using
Microsoft.CodeAnalysis.Notification
;
using
Microsoft.VisualStudio.CodeAnalysis
;
using
Microsoft.VisualStudio.ComponentModelHost
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem
;
using
Microsoft.VisualStudio.LanguageServices.SolutionExplorer
;
...
...
@@ -266,7 +267,7 @@ private void SetSeverityHandler(object sender, EventArgs args)
EnvDTE
.
Project
envDteProject
;
project
.
Hierarchy
.
TryGetProject
(
out
envDteProject
);
if
(
IsBuiltInRuleSet
(
pathToRuleSet
))
if
(
SdkUiUtilities
.
IsBuiltInRuleSet
(
pathToRuleSet
,
_serviceProvider
))
{
pathToRuleSet
=
CreateCopyOfRuleSetForProject
(
pathToRuleSet
,
envDteProject
);
if
(
pathToRuleSet
==
null
)
...
...
@@ -489,44 +490,5 @@ private Workspace TryGetWorkspace()
return
_workspace
;
}
private
bool
IsBuiltInRuleSet
(
string
pathToRuleSet
)
{
if
(
string
.
IsNullOrEmpty
(
pathToRuleSet
))
{
return
false
;
}
// Canonicalize and compare
string
ruleSetInBuiltInDirectory
=
Path
.
Combine
(
GetBuiltInRuleSetDirectory
(
_serviceProvider
),
Path
.
GetFileName
(
pathToRuleSet
));
if
(
ruleSetInBuiltInDirectory
.
Equals
(
Path
.
GetFullPath
(
pathToRuleSet
),
StringComparison
.
OrdinalIgnoreCase
))
{
FileInfo
ruleSetFile
=
new
FileInfo
(
pathToRuleSet
);
if
((
ruleSetFile
.
Attributes
&
FileAttributes
.
ReadOnly
)
==
FileAttributes
.
ReadOnly
)
{
return
true
;
}
}
return
false
;
}
private
string
GetBuiltInRuleSetDirectory
(
IServiceProvider
serviceProvider
)
{
return
Path
.
Combine
(
GetStaticAnalysisToolsDirectory
(
serviceProvider
),
"Rule Sets"
);
}
private
string
GetStaticAnalysisToolsDirectory
(
IServiceProvider
serviceProvider
)
{
string
installDirectory
=
null
;
// Get the VS install directory
IVsShell
shell
=
(
IVsShell
)
serviceProvider
.
GetService
(
typeof
(
IVsShell
));
object
value
;
Marshal
.
ThrowExceptionForHR
(
shell
.
GetProperty
((
int
)
__VSSPROPID2
.
VSSPROPID_InstallRootDir
,
out
value
));
installDirectory
=
(
string
)
value
;
return
Path
.
Combine
(
installDirectory
,
"Team Tools"
,
"Static Analysis Tools"
);
}
}
}
src/VisualStudio/Core/SolutionExplorerShim/SolutionExplorerShim.csproj
浏览文件 @
3f91cca0
...
...
@@ -25,6 +25,9 @@
<EmbedInteropTypes>
True
</EmbedInteropTypes>
</Reference>
<Reference
Include=
"..\..\..\..\packages\System.Collections.Immutable.1.1.33-beta\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll"
/>
<Reference
Include=
"Microsoft.VisualStudio.CodeAnalysis.Sdk.UI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<HintPath>
$(DevEnvDir)\PrivateAssemblies\Microsoft.VisualStudio.CodeAnalysis.Sdk.UI.dll
</HintPath>
</Reference>
</ItemGroup>
<ItemGroup
Label=
"Project References"
>
<ProjectReference
Include=
"..\..\..\Compilers\Core\Portable\CodeAnalysis.csproj"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录