Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
1ac495de
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,发现更多精彩内容 >>
提交
1ac495de
编写于
5月 13, 2020
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/master' into EnforceRemoveUnusedParameter
上级
41e306d6
435891d8
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
338 addition
and
53 deletion
+338
-53
.editorconfig
.editorconfig
+2
-0
src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs
.../CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs
+27
-6
src/Compilers/CSharp/Portable/FlowAnalysis/DefiniteAssignment.cs
...pilers/CSharp/Portable/FlowAnalysis/DefiniteAssignment.cs
+8
-5
src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs
...Sharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs
+13
-0
src/EditorFeatures/Core/FindUsages/IRemoteFindUsagesService.cs
...ditorFeatures/Core/FindUsages/IRemoteFindUsagesService.cs
+3
-3
src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs
...le/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs
+3
-1
src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs
...Variable/CSharpDisambiguateSameVariableCodeFixProvider.cs
+2
-0
src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs
...Variable/CSharpIntroduceVariableService_IntroduceLocal.cs
+2
-0
src/Features/CSharp/Portable/ReverseForStatement/CSharpReverseForStatementCodeRefactoringProvider.cs
...ement/CSharpReverseForStatementCodeRefactoringProvider.cs
+2
-0
src/Features/Core/Portable/ConflictMarkerResolution/AbstractConflictMarkerCodeFixProvider.cs
...MarkerResolution/AbstractConflictMarkerCodeFixProvider.cs
+2
-0
src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs
...es/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs
+7
-3
src/Features/Core/Portable/Diagnostics/IDiagnosticAnalyzerService.cs
...s/Core/Portable/Diagnostics/IDiagnosticAnalyzerService.cs
+1
-1
src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexCharClass.cs
...le/EmbeddedLanguages/RegularExpressions/RegexCharClass.cs
+6
-0
src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs
...tion/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs
+106
-16
src/VisualStudio/Core/Def/Implementation/Watson/WatsonReporter.cs
...alStudio/Core/Def/Implementation/Watson/WatsonReporter.cs
+10
-7
src/VisualStudio/Core/Def/ServicesVSResources.resx
src/VisualStudio/Core/Def/ServicesVSResources.resx
+6
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf
src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf
...VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf
+10
-0
src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf
...VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf
+10
-0
src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb
...e/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb
+1
-1
src/Workspaces/Core/Portable/Rename/ConflictEngine/RenamedSpansTracker.cs
...ore/Portable/Rename/ConflictEngine/RenamedSpansTracker.cs
+2
-0
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/AnchorIndentationFormattingRule.cs
...Sharp/Formatting/Rules/AnchorIndentationFormattingRule.cs
+1
-1
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/IndentBlockFormattingRule.cs
...iler/CSharp/Formatting/Rules/IndentBlockFormattingRule.cs
+2
-9
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SelectedMembers/AbstractSelectedMembers.cs
.../Core/Services/SelectedMembers/AbstractSelectedMembers.cs
+2
-0
未找到文件。
.editorconfig
浏览文件 @
1ac495de
...
...
@@ -231,6 +231,8 @@ dotnet_diagnostic.IDE0005.severity = warning
# IDE0011: Add braces
csharp_prefer_braces = when_multiline:warning
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
dotnet_diagnostic.IDE0011.severity = warning
# IDE0035: Remove unreachable code
dotnet_diagnostic.IDE0035.severity = warning
...
...
src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs
浏览文件 @
1ac495de
...
...
@@ -72,7 +72,11 @@ private static bool InvalidLevel(int? level)
case
SyntaxKind
.
NamespaceDeclaration
:
{
var
ns
=
(
NamespaceDeclarationSyntax
)
node
;
foreach
(
var
decl
in
ns
.
Members
)
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
foreach
(
var
decl
in
ns
.
Members
)
{
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
}
var
declInfo
=
GetDeclarationInfo
(
model
,
node
,
getSymbol
,
cancellationToken
);
builder
.
Add
(
declInfo
);
...
...
@@ -94,7 +98,11 @@ private static bool InvalidLevel(int? level)
case
SyntaxKind
.
InterfaceDeclaration
:
{
var
t
=
(
TypeDeclarationSyntax
)
node
;
foreach
(
var
decl
in
t
.
Members
)
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
foreach
(
var
decl
in
t
.
Members
)
{
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
}
var
attributes
=
GetAttributes
(
t
.
AttributeLists
).
Concat
(
GetTypeParameterListAttributes
(
t
.
TypeParameterList
));
builder
.
Add
(
GetDeclarationInfo
(
model
,
node
,
getSymbol
,
attributes
,
cancellationToken
));
return
;
...
...
@@ -103,7 +111,11 @@ private static bool InvalidLevel(int? level)
case
SyntaxKind
.
EnumDeclaration
:
{
var
t
=
(
EnumDeclarationSyntax
)
node
;
foreach
(
var
decl
in
t
.
Members
)
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
foreach
(
var
decl
in
t
.
Members
)
{
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
}
var
attributes
=
GetAttributes
(
t
.
AttributeLists
);
builder
.
Add
(
GetDeclarationInfo
(
model
,
node
,
getSymbol
,
attributes
,
cancellationToken
));
return
;
...
...
@@ -133,7 +145,10 @@ private static bool InvalidLevel(int? level)
var
t
=
(
EventDeclarationSyntax
)
node
;
if
(
t
.
AccessorList
!=
null
)
{
foreach
(
var
decl
in
t
.
AccessorList
.
Accessors
)
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
foreach
(
var
decl
in
t
.
AccessorList
.
Accessors
)
{
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
}
}
var
attributes
=
GetAttributes
(
t
.
AttributeLists
);
builder
.
Add
(
GetDeclarationInfo
(
model
,
node
,
getSymbol
,
attributes
,
cancellationToken
));
...
...
@@ -170,7 +185,10 @@ private static bool InvalidLevel(int? level)
var
t
=
(
PropertyDeclarationSyntax
)
node
;
if
(
t
.
AccessorList
!=
null
)
{
foreach
(
var
decl
in
t
.
AccessorList
.
Accessors
)
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
foreach
(
var
decl
in
t
.
AccessorList
.
Accessors
)
{
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
}
}
if
(
t
.
ExpressionBody
!=
null
)
...
...
@@ -259,7 +277,10 @@ private static bool InvalidLevel(int? level)
case
SyntaxKind
.
CompilationUnit
:
{
var
t
=
(
CompilationUnitSyntax
)
node
;
foreach
(
var
decl
in
t
.
Members
)
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
foreach
(
var
decl
in
t
.
Members
)
{
ComputeDeclarations
(
model
,
decl
,
shouldSkip
,
getSymbol
,
builder
,
newLevel
,
cancellationToken
);
}
if
(
t
.
AttributeLists
.
Any
())
{
...
...
src/Compilers/CSharp/Portable/FlowAnalysis/DefiniteAssignment.cs
浏览文件 @
1ac495de
...
...
@@ -1879,6 +1879,7 @@ public override BoundNode VisitAddressOfOperator(BoundAddressOfOperator node)
return
null
;
}
#
nullable
enable
protected
override
void
WriteArgument
(
BoundExpression
arg
,
RefKind
refKind
,
MethodSymbol
method
)
{
if
(
refKind
==
RefKind
.
Ref
)
...
...
@@ -1895,11 +1896,12 @@ protected override void WriteArgument(BoundExpression arg, RefKind refKind, Meth
// we assume that external method may write and/or read all of its fields (recursively).
// Strangely, the native compiler requires the "ref", even for reference types, to exhibit
// this behavior.
if
(
refKind
!=
RefKind
.
None
&&
((
object
)
method
==
null
||
method
.
IsExtern
))
if
(
refKind
!=
RefKind
.
None
&&
((
object
)
method
==
null
||
method
.
IsExtern
)
&&
arg
.
Type
is
TypeSymbol
type
)
{
MarkFieldsUsed
(
arg
.
T
ype
);
MarkFieldsUsed
(
t
ype
);
}
}
#
nullable
restore
protected
void
CheckAssigned
(
BoundExpression
expr
,
SyntaxNode
node
)
{
...
...
@@ -1936,6 +1938,7 @@ protected void CheckAssigned(BoundExpression expr, SyntaxNode node)
}
}
#
nullable
enable
private
void
MarkFieldsUsed
(
TypeSymbol
type
)
{
switch
(
type
.
TypeKind
)
...
...
@@ -1951,9 +1954,7 @@ private void MarkFieldsUsed(TypeSymbol type)
return
;
}
var
namedType
=
(
NamedTypeSymbol
)
type
;
var
assembly
=
type
.
ContainingAssembly
as
SourceAssemblySymbol
;
if
((
object
)
assembly
==
null
)
if
(!(
type
.
ContainingAssembly
is
SourceAssemblySymbol
assembly
))
{
return
;
// could be retargeting assembly
}
...
...
@@ -1961,6 +1962,7 @@ private void MarkFieldsUsed(TypeSymbol type)
var
seen
=
assembly
.
TypesReferencedInExternalMethods
;
if
(
seen
.
Add
(
type
))
{
var
namedType
=
(
NamedTypeSymbol
)
type
;
foreach
(
var
symbol
in
namedType
.
GetMembersUnordered
())
{
if
(
symbol
.
Kind
!=
SymbolKind
.
Field
)
...
...
@@ -1976,6 +1978,7 @@ private void MarkFieldsUsed(TypeSymbol type)
return
;
}
}
#
nullable
restore
public
override
BoundNode
VisitBaseReference
(
BoundBaseReference
node
)
{
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs
浏览文件 @
1ac495de
...
...
@@ -990,6 +990,19 @@ void M()
Diagnostic
(
ErrorCode
.
ERR_RefLocalOrParamExpected
,
"P"
).
WithLocation
(
8
,
9
));
}
[
Fact
,
WorkItem
(
44153
,
"https://github.com/dotnet/roslyn/issues/44153"
)]
public
void
RefErrorProperty
()
{
CreateCompilation
(
@"
public class C {
public ref ERROR Prop => throw null!;
}
"
).
VerifyEmitDiagnostics
(
// (3,16): error CS0246: The type or namespace name 'ERROR' could not be found (are you missing a using directive or an assembly reference?)
// public ref ERROR Prop => throw null!;
Diagnostic
(
ErrorCode
.
ERR_SingleTypeNameNotFound
,
"ERROR"
).
WithArguments
(
"ERROR"
).
WithLocation
(
3
,
16
));
}
[
Fact
]
public
void
RefReadonlyOnlyIn72
()
{
...
...
src/EditorFeatures/Core/FindUsages/IRemoteFindUsagesService.cs
浏览文件 @
1ac495de
...
...
@@ -163,7 +163,7 @@ internal class SerializableSourceReferenceItem
{
public
int
DefinitionId
;
public
SerializableDocumentSpan
SourceSpan
;
public
SymbolUsageInfo
SymbolUsageInfo
;
public
S
erializableS
ymbolUsageInfo
SymbolUsageInfo
;
public
(
string
Key
,
string
Value
)[]
AdditionalProperties
;
public
static
SerializableSourceReferenceItem
Dehydrate
(
...
...
@@ -173,7 +173,7 @@ internal class SerializableSourceReferenceItem
{
DefinitionId
=
definitionId
,
SourceSpan
=
SerializableDocumentSpan
.
Dehydrate
(
item
.
SourceSpan
),
SymbolUsageInfo
=
item
.
SymbolUsageInfo
,
SymbolUsageInfo
=
SerializableSymbolUsageInfo
.
Dehydrate
(
item
.
SymbolUsageInfo
)
,
AdditionalProperties
=
item
.
AdditionalProperties
.
Select
(
kvp
=>
(
kvp
.
Key
,
kvp
.
Value
)).
ToArray
(),
};
}
...
...
@@ -183,7 +183,7 @@ public SourceReferenceItem Rehydrate(Solution solution, DefinitionItem definitio
return
new
SourceReferenceItem
(
definition
,
SourceSpan
.
Rehydrate
(
solution
),
SymbolUsageInfo
,
SymbolUsageInfo
.
Rehydrate
()
,
AdditionalProperties
.
ToImmutableDictionary
(
t
=>
t
.
Key
,
t
=>
t
.
Value
));
}
}
...
...
src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs
浏览文件 @
1ac495de
...
...
@@ -98,8 +98,10 @@ public bool TryConvert(out DocumentUpdateInfo documentUpdateInfo)
{
if
(!
documentUpdateInfo
.
Source
.
IsParentKind
(
SyntaxKind
.
Block
)
&&
documentUpdateInfo
.
Destinations
.
Length
>
1
)
{
documentUpdateInfo
=
new
DocumentUpdateInfo
(
documentUpdateInfo
.
Source
,
SyntaxFactory
.
Block
(
documentUpdateInfo
.
Destinations
));
}
return
true
;
}
...
...
src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs
浏览文件 @
1ac495de
...
...
@@ -155,7 +155,9 @@ where m.IsAccessibleWithin(enclosingType)
{
if
(!
CanFix
(
semanticModel
,
diagnostic
,
cancellationToken
,
out
var
nameNode
,
out
var
matchingMember
,
out
_
))
{
continue
;
}
var
newNameNode
=
matchingMember
.
Name
.
ToIdentifierName
();
var
newExpr
=
(
ExpressionSyntax
)
newNameNode
;
...
...
src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs
浏览文件 @
1ac495de
...
...
@@ -419,8 +419,10 @@ private int GetFirstStatementAffectedIndex(SyntaxNode innermostCommonBlock, ISet
var
nextStatementLeading
=
nextStatement
.
GetLeadingTrivia
();
var
precedingEndOfLine
=
nextStatementLeading
.
LastOrDefault
(
t
=>
t
.
Kind
()
==
SyntaxKind
.
EndOfLineTrivia
);
if
(
precedingEndOfLine
==
default
)
{
return
oldStatements
.
ReplaceRange
(
nextStatement
,
new
[]
{
newStatement
,
nextStatement
});
}
var
endOfLineIndex
=
nextStatementLeading
.
IndexOf
(
precedingEndOfLine
)
+
1
;
...
...
src/Features/CSharp/Portable/ReverseForStatement/CSharpReverseForStatementCodeRefactoringProvider.cs
浏览文件 @
1ac495de
...
...
@@ -53,7 +53,9 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
if
(
declaration
==
null
||
declaration
.
Variables
.
Count
!=
1
||
forStatement
.
Incrementors
.
Count
!=
1
)
{
return
;
}
var
variable
=
declaration
.
Variables
[
0
];
var
after
=
forStatement
.
Incrementors
[
0
];
...
...
src/Features/Core/Portable/ConflictMarkerResolution/AbstractConflictMarkerCodeFixProvider.cs
浏览文件 @
1ac495de
...
...
@@ -93,7 +93,9 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
// issue there.
if
(
startTrivia
.
RawKind
==
_syntaxKinds
.
ConflictMarkerTrivia
||
middleTrivia
.
RawKind
==
_syntaxKinds
.
ConflictMarkerTrivia
)
{
return
false
;
}
}
return
true
;
...
...
src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService.cs
浏览文件 @
1ac495de
...
...
@@ -131,7 +131,7 @@ public Task<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(Solution solutio
return
SpecializedTasks
.
EmptyImmutableArray
<
DiagnosticData
>();
}
public
async
Task
ForceAnalyzeAsync
(
Solution
solution
,
ProjectId
?
projectId
=
null
,
CancellationToken
cancellationToken
=
default
)
public
async
Task
ForceAnalyzeAsync
(
Solution
solution
,
Action
<
Project
>
onProjectAnalyzed
,
ProjectId
?
projectId
=
null
,
CancellationToken
cancellationToken
=
default
)
{
if
(
_map
.
TryGetValue
(
solution
.
Workspace
,
out
var
analyzer
))
{
...
...
@@ -141,6 +141,7 @@ public async Task ForceAnalyzeAsync(Solution solution, ProjectId? projectId = nu
if
(
project
!=
null
)
{
await
analyzer
.
ForceAnalyzeProjectAsync
(
project
,
cancellationToken
).
ConfigureAwait
(
false
);
onProjectAnalyzed
(
project
);
}
}
else
...
...
@@ -149,8 +150,11 @@ public async Task ForceAnalyzeAsync(Solution solution, ProjectId? projectId = nu
var
index
=
0
;
foreach
(
var
project
in
solution
.
Projects
)
{
tasks
[
index
++]
=
Task
.
Run
(
()
=>
analyzer
.
ForceAnalyzeProjectAsync
(
project
,
cancellationToken
));
tasks
[
index
++]
=
Task
.
Run
(
async
()
=>
{
await
analyzer
.
ForceAnalyzeProjectAsync
(
project
,
cancellationToken
).
ConfigureAwait
(
false
);
onProjectAnalyzed
(
project
);
});
}
await
Task
.
WhenAll
(
tasks
).
ConfigureAwait
(
false
);
...
...
src/Features/Core/Portable/Diagnostics/IDiagnosticAnalyzerService.cs
浏览文件 @
1ac495de
...
...
@@ -43,7 +43,7 @@ internal interface IDiagnosticAnalyzerService
/// <summary>
/// Force computes diagnostics and raises diagnostic events for the given project or solution. all diagnostics returned should be up-to-date with respect to the given project or solution.
/// </summary>
Task
ForceAnalyzeAsync
(
Solution
solution
,
ProjectId
?
projectId
=
null
,
CancellationToken
cancellationToken
=
default
);
Task
ForceAnalyzeAsync
(
Solution
solution
,
Action
<
Project
>
onProjectAnalyzed
,
ProjectId
?
projectId
=
null
,
CancellationToken
cancellationToken
=
default
);
/// <summary>
/// True if given project has any diagnostics
...
...
src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexCharClass.cs
浏览文件 @
1ac495de
...
...
@@ -269,7 +269,9 @@ private static bool CharInClassInternal(char ch, string set, int start, int mySe
// reverse this check.
Debug
.
Assert
((
SETSTART
&
0x1
)
==
1
,
"If SETSTART is not odd, the calculation below this will be reversed"
);
if
((
min
&
0x1
)
==
(
start
&
0x1
))
{
return
true
;
}
else
{
if
(
myCategoryLength
==
0
)
...
...
@@ -302,7 +304,9 @@ private static bool CharInCategory(char ch, string set, int start, int mySetLeng
if
(
curcat
==
SpaceConst
)
{
if
(
char
.
IsWhiteSpace
(
ch
))
{
return
true
;
}
else
{
i
++;
...
...
@@ -320,7 +324,9 @@ private static bool CharInCategory(char ch, string set, int start, int mySetLeng
if
(
curcat
==
NotSpaceConst
)
{
if
(!
char
.
IsWhiteSpace
(
ch
))
{
return
true
;
}
else
{
i
++;
...
...
src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs
浏览文件 @
1ac495de
...
...
@@ -199,29 +199,30 @@ public void RunAnalyzers(IVsHierarchy? hierarchy)
string
?
projectOrSolutionName
=
project
?.
Name
??
PathUtilities
.
GetFileName
(
solution
.
FilePath
);
// Add a message to VS status bar that we are running code analysis.
var
statusMessage
=
projectOrSolutionName
!=
null
?
string
.
Format
(
ServicesVSResources
.
Running_code_analysis_for_0
,
projectOrSolutionName
)
:
ServicesVSResources
.
Running_code_analysis_for_Solution
;
var
statusBar
=
_serviceProvider
?.
GetService
(
typeof
(
SVsStatusbar
))
as
IVsStatusbar
;
statusBar
?.
SetText
(
statusMessage
);
var
totalProjectCount
=
project
!=
null
?
1
:
(
uint
)
solution
.
ProjectIds
.
Count
;
var
statusBarUpdater
=
statusBar
!=
null
?
new
StatusBarUpdater
(
statusBar
,
_threadingContext
,
projectOrSolutionName
,
totalProjectCount
)
:
null
;
// Force complete analyzer execution in background.
var
asyncToken
=
_listener
.
BeginAsyncOperation
(
$"
{
nameof
(
VisualStudioDiagnosticAnalyzerService
)}
_
{
nameof
(
RunAnalyzers
)}
"
);
Task
.
Run
(
async
()
=>
{
await
_diagnosticService
.
ForceAnalyzeAsync
(
solution
,
project
?.
Id
,
CancellationToken
.
None
).
ConfigureAwait
(
false
);
// If user has disabled live analyzer execution for any project(s), i.e. set RunAnalyzersDuringLiveAnalysis = false,
// then ForceAnalyzeAsync will not cause analyzers to execute.
// We explicitly fetch diagnostics for such projects and report these as "Host" diagnostics.
HandleProjectsWithDisabledAnalysis
();
try
{
var
onProjectAnalyzed
=
statusBarUpdater
!=
null
?
statusBarUpdater
.
OnProjectAnalyzed
:
(
Action
<
Project
>)((
Project
_
)
=>
{
});
await
_diagnosticService
.
ForceAnalyzeAsync
(
solution
,
onProjectAnalyzed
,
project
?.
Id
,
CancellationToken
.
None
).
ConfigureAwait
(
false
);
// Add a message to VS status bar that we completed executing code analysis.
await
_threadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
();
var
notificationMesage
=
projectOrSolutionName
!=
null
?
string
.
Format
(
ServicesVSResources
.
Code_analysis_completed_for_0
,
projectOrSolutionName
)
:
ServicesVSResources
.
Code_analysis_completed_for_Solution
;
statusBar
?.
SetText
(
notificationMesage
);
// If user has disabled live analyzer execution for any project(s), i.e. set RunAnalyzersDuringLiveAnalysis = false,
// then ForceAnalyzeAsync will not cause analyzers to execute.
// We explicitly fetch diagnostics for such projects and report these as "Host" diagnostics.
HandleProjectsWithDisabledAnalysis
();
}
finally
{
statusBarUpdater
?.
Dispose
();
}
}).
CompletesAsyncOperation
(
asyncToken
);
return
;
...
...
@@ -348,5 +349,94 @@ private bool IsBuildActive()
}
}
}
private
sealed
class
StatusBarUpdater
:
IDisposable
{
private
readonly
IVsStatusbar
_statusBar
;
private
readonly
IThreadingContext
_threadingContext
;
private
readonly
uint
_totalProjectCount
;
private
readonly
string
_statusMessageWhileRunning
;
private
readonly
string
_statusMesageOnCompleted
;
private
readonly
string
_statusMesageOnTerminated
;
private
readonly
Timer
_timer
;
private
int
_analyzedProjectCount
;
private
bool
_disposed
;
private
uint
_statusBarCookie
;
public
StatusBarUpdater
(
IVsStatusbar
statusBar
,
IThreadingContext
threadingContext
,
string
?
projectOrSolutionName
,
uint
totalProjectCount
)
{
Contract
.
ThrowIfFalse
(
threadingContext
.
HasMainThread
);
_statusBar
=
statusBar
;
_threadingContext
=
threadingContext
;
_totalProjectCount
=
totalProjectCount
;
_statusMessageWhileRunning
=
projectOrSolutionName
!=
null
?
string
.
Format
(
ServicesVSResources
.
Running_code_analysis_for_0
,
projectOrSolutionName
)
:
ServicesVSResources
.
Running_code_analysis_for_Solution
;
_statusMesageOnCompleted
=
projectOrSolutionName
!=
null
?
string
.
Format
(
ServicesVSResources
.
Code_analysis_completed_for_0
,
projectOrSolutionName
)
:
ServicesVSResources
.
Code_analysis_completed_for_Solution
;
_statusMesageOnTerminated
=
projectOrSolutionName
!=
null
?
string
.
Format
(
ServicesVSResources
.
Code_analysis_terminated_before_completion_for_0
,
projectOrSolutionName
)
:
ServicesVSResources
.
Code_analysis_terminated_before_completion_for_Solution
;
// Set the initial status bar progress and text.
_statusBar
.
Progress
(
ref
_statusBarCookie
,
fInProgress
:
1
,
_statusMessageWhileRunning
,
nComplete
:
0
,
nTotal
:
totalProjectCount
);
_statusBar
.
SetText
(
_statusMessageWhileRunning
);
// Create a timer to periodically update the status message while running analysis.
_timer
=
new
Timer
(
new
TimerCallback
(
UpdateStatusOnTimer
),
new
AutoResetEvent
(
false
),
dueTime
:
TimeSpan
.
FromSeconds
(
5
),
period
:
TimeSpan
.
FromSeconds
(
5
));
}
internal
void
OnProjectAnalyzed
(
Project
_
)
{
Interlocked
.
Increment
(
ref
_analyzedProjectCount
);
UpdateStatusCore
();
}
// Add a message to VS status bar that we are running code analysis.
private
void
UpdateStatusOnTimer
(
object
state
)
=>
UpdateStatusCore
();
public
void
Dispose
()
{
_timer
.
Dispose
();
_disposed
=
true
;
UpdateStatusCore
();
}
private
void
UpdateStatusCore
()
{
_threadingContext
.
JoinableTaskFactory
.
RunAsync
(
async
()
=>
{
await
_threadingContext
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
();
string
message
;
int
fInProgress
;
var
analyzedProjectCount
=
(
uint
)
_analyzedProjectCount
;
if
(
analyzedProjectCount
==
_totalProjectCount
)
{
message
=
_statusMesageOnCompleted
;
fInProgress
=
0
;
}
else
if
(
_disposed
)
{
message
=
_statusMesageOnTerminated
;
fInProgress
=
0
;
}
else
{
message
=
_statusMessageWhileRunning
;
fInProgress
=
1
;
}
// Update the status bar progress and text.
_statusBar
.
Progress
(
ref
_statusBarCookie
,
fInProgress
,
message
,
analyzedProjectCount
,
_totalProjectCount
);
_statusBar
.
SetText
(
message
);
});
}
}
}
}
src/VisualStudio/Core/Def/Implementation/Watson/WatsonReporter.cs
浏览文件 @
1ac495de
...
...
@@ -93,16 +93,19 @@ public static void ReportNonFatal(Exception exception)
exceptionObject
:
exception
,
gatherEventDetails
:
faultUtility
=>
{
// add current process dump
faultUtility
.
AddProcessDump
(
currentProcess
.
Id
);
// add ServiceHub log files:
foreach
(
var
path
in
CollectServiceHubLogFilePaths
())
if
(
faultUtility
is
FaultEvent
{
IsIncludedInWatsonSample
:
true
})
{
faultUtility
.
AddFile
(
path
);
// add ServiceHub log files:
foreach
(
var
path
in
CollectServiceHubLogFilePaths
())
{
faultUtility
.
AddFile
(
path
);
}
}
// Returning "0" signals that we should send data to Watson; any other value will cancel the Watson report.
// Returning "0" signals that, if sampled, we should send data to Watson.
// Any other value will cancel the Watson report. We never want to trigger a process dump manually,
// we'll let TargetedNotifications determine if a dump should be collected.
// See https://aka.ms/roslynnfwdocs for more details
return
0
;
});
...
...
src/VisualStudio/Core/Def/ServicesVSResources.resx
浏览文件 @
1ac495de
...
...
@@ -1344,6 +1344,12 @@ I agree to all of the foregoing:</value>
<data
name=
"Code_analysis_completed_for_Solution"
xml:space=
"preserve"
>
<value>
Code analysis completed for Solution.
</value>
</data>
<data
name=
"Code_analysis_terminated_before_completion_for_0"
xml:space=
"preserve"
>
<value>
Code analysis terminated before completion for '{0}'.
</value>
</data>
<data
name=
"Code_analysis_terminated_before_completion_for_Solution"
xml:space=
"preserve"
>
<value>
Code analysis terminated before completion for Solution.
</value>
</data>
<data
name=
"Background_analysis_scope_colon"
xml:space=
"preserve"
>
<value>
Background analysis scope:
</value>
</data>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Dokončila se analýza kódu pro řešení.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Obarvit regulární výrazy
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Die Codeanalyse für die Projektmappe wurde abgeschlossen.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Reguläre Ausdrücke farbig hervorheben
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
El análisis de código se ha completado para la solución.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Colorear expresiones regulares
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Analyse du code effectuée pour la solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Coloriser les expressions régulières
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Analisi codice completata per la soluzione.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Colora espressioni regolari
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
ソリューションのコード分析が完了しました。
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
正規表現をカラー化
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
솔루션에 대한 코드 분석이 완료되었습니다.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
정규식 색 지정
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Ukończono analizę kodu dla rozwiązania.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Koloruj wyrażenia regularne
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Análise de código concluída para a Solução.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Colorir expressões regulares
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Анализ кода для решения выполнен.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Выделить регулярные выражения цветом
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
Çözüm için kod analizi tamamlandı.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
Normal ifadeleri renklendir
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
解决方案的代码分析已完成。
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
为正规表达式着色
</target>
...
...
src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf
浏览文件 @
1ac495de
...
...
@@ -122,6 +122,16 @@
<target
state=
"translated"
>
解決方案的程式碼分析已完成。
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_0"
>
<source>
Code analysis terminated before completion for '{0}'.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for '{0}'.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Code_analysis_terminated_before_completion_for_Solution"
>
<source>
Code analysis terminated before completion for Solution.
</source>
<target
state=
"new"
>
Code analysis terminated before completion for Solution.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Colorize_regular_expressions"
>
<source>
Colorize regular expressions
</source>
<target
state=
"translated"
>
為規則運算式添加色彩
</target>
...
...
src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb
浏览文件 @
1ac495de
...
...
@@ -508,7 +508,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Throw
New
NotImplementedException
()
End
Function
Public
Function
ForceAnalyzeAsync
(
solution
As
Solution
,
Optional
projectId
As
ProjectId
=
Nothing
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
Implements
IDiagnosticAnalyzerService
.
ForceAnalyzeAsync
Public
Function
ForceAnalyzeAsync
(
solution
As
Solution
,
onProjectAnalyzed
As
Action
(
Of
Project
),
Optional
projectId
As
ProjectId
=
Nothing
,
Optional
cancellationToken
As
CancellationToken
=
Nothing
)
As
Task
Implements
IDiagnosticAnalyzerService
.
ForceAnalyzeAsync
Throw
New
NotImplementedException
()
End
Function
End
Class
...
...
src/Workspaces/Core/Portable/Rename/ConflictEngine/RenamedSpansTracker.cs
浏览文件 @
1ac495de
...
...
@@ -237,8 +237,10 @@ internal async Task<Solution> SimplifyAsync(Solution solution, IEnumerable<Docum
var
builder
=
ImmutableDictionary
.
CreateBuilder
<
DocumentId
,
ImmutableArray
<
ComplexifiedSpan
>>();
foreach
(
var
(
docId
,
spans
)
in
_documentToComplexifiedSpansMap
)
{
builder
.
Add
(
docId
,
spans
.
SelectAsArray
(
s
=>
new
ComplexifiedSpan
(
s
.
OriginalSpan
,
s
.
NewSpan
,
s
.
ModifiedSubSpans
.
ToImmutableArray
())));
}
return
builder
.
ToImmutable
();
}
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/AnchorIndentationFormattingRule.cs
浏览文件 @
1ac495de
...
...
@@ -68,7 +68,7 @@ public override void AddAnchorIndentationOperations(List<AnchorIndentationOperat
case
AccessorDeclarationSyntax
accessorDeclNode
:
AddAnchorIndentationOperation
(
list
,
accessorDeclNode
);
return
;
case
CSharpSyntaxNode
switchExpressionArm
when
switchExpressionArm
.
IsKind
(
SyntaxKind
.
SwitchExpressionArm
)
:
case
SwitchExpressionArmSyntax
switchExpressionArm
:
// The expression in a switch expression arm should be anchored to the beginning of the arm
// ```
// e switch
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/IndentBlockFormattingRule.cs
浏览文件 @
1ac495de
...
...
@@ -7,12 +7,10 @@
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Formatting.Rules
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Text
;
using
Roslyn.Utilities
;
...
...
@@ -177,13 +175,8 @@ private void AddAlignmentBlockOperation(List<IndentBlockOperation> list, SyntaxN
case
ImplicitArrayCreationExpressionSyntax
implicitArrayCreation
when
implicitArrayCreation
.
Initializer
!=
null
:
SetAlignmentBlockOperation
(
list
,
implicitArrayCreation
.
NewKeyword
,
implicitArrayCreation
.
Initializer
.
OpenBraceToken
,
implicitArrayCreation
.
Initializer
.
CloseBraceToken
,
IndentBlockOption
.
RelativeToFirstTokenOnBaseTokenLine
);
return
;
case
CSharpSyntaxNode
syntaxNode
when
syntaxNode
.
IsKind
(
SyntaxKind
.
SwitchExpression
):
SetAlignmentBlockOperation
(
list
,
syntaxNode
.
GetFirstToken
(),
syntaxNode
.
ChildNodesAndTokens
().
First
(
child
=>
child
.
IsKind
(
SyntaxKind
.
OpenBraceToken
)).
AsToken
(),
syntaxNode
.
ChildNodesAndTokens
().
Last
(
child
=>
child
.
IsKind
(
SyntaxKind
.
CloseBraceToken
)).
AsToken
(),
IndentBlockOption
.
RelativeToFirstTokenOnBaseTokenLine
);
case
SwitchExpressionSyntax
switchExpression
:
SetAlignmentBlockOperation
(
list
,
switchExpression
.
GetFirstToken
(),
switchExpression
.
OpenBraceToken
,
switchExpression
.
CloseBraceToken
,
IndentBlockOption
.
RelativeToFirstTokenOnBaseTokenLine
);
return
;
}
}
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SelectedMembers/AbstractSelectedMembers.cs
浏览文件 @
1ac495de
...
...
@@ -102,7 +102,9 @@ void AddSelectedFieldOrPropertyDeclarations(TMemberDeclarationSyntax member)
{
if
(!(
member
is
TFieldDeclarationSyntax
)
&&
!(
member
is
TPropertyDeclarationSyntax
))
{
return
;
}
// first, check if entire member is selected. If so, we definitely include this member.
if
(
textSpan
.
Contains
(
member
.
Span
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录