Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
855744d1
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,发现更多精彩内容 >>
提交
855744d1
编写于
5月 20, 2020
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix callsites not updated by code fix (TODO: File a bug for the code fixer)
上级
a9ee8d88
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
58 addition
and
57 deletion
+58
-57
src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs
src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs
+1
-1
src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs
...stUtilities/EditAndContinue/EditAndContinueTestHelpers.cs
+8
-8
src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs
...xtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs
+1
-1
src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs
...atching/CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs
+1
-1
src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs
...hing/CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs
+1
-1
src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs
...ctorParametersFromMembersCodeRefactoringProvider.State.cs
+1
-1
src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs
...Features/Core/Portable/AddImport/SymbolReferenceFinder.cs
+1
-1
src/Features/Core/Portable/ChangeSignature/ChangeSignatureCodeAction.cs
...ore/Portable/ChangeSignature/ChangeSignatureCodeAction.cs
+1
-1
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs
...neV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs
+2
-2
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs
...ateConstructorFromMembersCodeRefactoringProvider.State.cs
+1
-1
src/Features/Core/Portable/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs
...rateEnumMember/AbstractGenerateEnumMemberService.State.cs
+2
-2
src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs
...arameterizedMember/AbstractGenerateMethodService.State.cs
+1
-1
src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.State.cs
...ember/AbstractGenerateParameterizedMemberService.State.cs
+1
-1
src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs
...GenerateVariable/AbstractGenerateVariableService.State.cs
+2
-2
src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.State.cs
...ortable/GenerateType/AbstractGenerateTypeService.State.cs
+1
-1
src/Features/Core/Portable/ReplaceMethodWithProperty/AbstractReplaceMethodWithPropertyService.cs
...dWithProperty/AbstractReplaceMethodWithPropertyService.cs
+3
-1
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContext.cs
...ore/Portable/CodeFixes/FixAllOccurrences/FixAllContext.cs
+1
-1
src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
+1
-1
src/Workspaces/Core/Portable/Execution/SolutionSynchronizationService.cs
...Core/Portable/Execution/SolutionSynchronizationService.cs
+1
-1
src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs
.../Portable/Simplification/AbstractSimplificationService.cs
+1
-1
src/Workspaces/Core/Portable/SolutionCrawler/IIncrementalAnalyzerExtensions.cs
...ortable/SolutionCrawler/IIncrementalAnalyzerExtensions.cs
+2
-2
src/Workspaces/Core/Portable/Workspace/Workspace.cs
src/Workspaces/Core/Portable/Workspace/Workspace.cs
+3
-3
src/Workspaces/Remote/ServiceHub/Shared/RoslynJsonConverter.RoslynOnly.cs
...emote/ServiceHub/Shared/RoslynJsonConverter.RoslynOnly.cs
+6
-1
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SpacingFormattingRule.cs
...Compiler/CSharp/Formatting/Rules/SpacingFormattingRule.cs
+1
-1
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.Rewriter.cs
...ervices/CSharpRemoveUnnecessaryImportsService.Rewriter.cs
+2
-5
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs
...LanguageServices/CSharpRemoveUnnecessaryImportsService.cs
+1
-1
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs
...nguageServices/CSharpTypeInferenceService.TypeInferrer.cs
+4
-4
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicRemoveUnnecessaryImportsService.Rewriter.vb
...es/VisualBasicRemoveUnnecessaryImportsService.Rewriter.vb
+2
-5
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicRemoveUnnecessaryImportsService.vb
...ageServices/VisualBasicRemoveUnnecessaryImportsService.vb
+1
-1
src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicCodeGenerationService.vb
...rtable/CodeGeneration/VisualBasicCodeGenerationService.vb
+1
-1
src/Workspaces/VisualBasic/Portable/Editing/VisualBasicImportAdder.vb
...es/VisualBasic/Portable/Editing/VisualBasicImportAdder.vb
+1
-1
src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb
...lBasic/Portable/Indentation/SpecialFormattingOperation.vb
+2
-2
未找到文件。
src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs
浏览文件 @
855744d1
...
...
@@ -76,7 +76,7 @@ public FixAll(AbstractFormattingCodeFixProvider formattingCodeFixProvider)
protected
override
async
Task
<
SyntaxNode
>
FixAllInDocumentAsync
(
FixAllContext
fixAllContext
,
Document
document
,
ImmutableArray
<
Diagnostic
>
diagnostics
)
{
var
options
=
await
_formattingCodeFixProvider
.
GetOptionsAsync
(
document
,
fixAllContext
.
CancellationToken
).
ConfigureAwait
(
false
);
var
options
=
await
GetOptionsAsync
(
document
,
fixAllContext
.
CancellationToken
).
ConfigureAwait
(
false
);
var
syntaxRoot
=
await
document
.
GetSyntaxRootAsync
(
fixAllContext
.
CancellationToken
).
ConfigureAwait
(
false
);
var
updatedSyntaxRoot
=
Formatter
.
Format
(
syntaxRoot
,
_formattingCodeFixProvider
.
SyntaxFormattingService
,
options
,
fixAllContext
.
CancellationToken
);
return
updatedSyntaxRoot
;
...
...
src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs
浏览文件 @
855744d1
...
...
@@ -7,7 +7,6 @@
using
System.Collections.Immutable
;
using
System.Linq
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.Differencing
;
using
Microsoft.CodeAnalysis.Emit
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
...
...
@@ -15,6 +14,7 @@
using
Roslyn.Test.Utilities
;
using
Roslyn.Utilities
;
using
Xunit
;
using
static
Microsoft
.
CodeAnalysis
.
EditAndContinue
.
AbstractEditAndContinueAnalyzer
;
namespace
Microsoft.CodeAnalysis.EditAndContinue.UnitTests
{
...
...
@@ -96,8 +96,8 @@ internal abstract class EditAndContinueTestHelpers
var
diagnostics
=
new
List
<
RudeEditDiagnostic
>();
var
actualNewActiveStatements
=
new
ActiveStatement
[
oldActiveStatements
.
Length
];
var
actualNewExceptionRegions
=
new
ImmutableArray
<
LinePositionSpan
>[
oldActiveStatements
.
Length
];
var
updatedActiveMethodMatches
=
new
List
<
AbstractEditAndContinueAnalyzer
.
UpdatedMemberInfo
>();
var
editMap
=
Analyzer
.
BuildEditMap
(
editScript
);
var
updatedActiveMethodMatches
=
new
List
<
UpdatedMemberInfo
>();
var
editMap
=
BuildEditMap
(
editScript
);
var
documentId
=
DocumentId
.
CreateNewId
(
ProjectId
.
CreateNewId
(
"TestEnCProject"
),
"TestEnCDocument"
);
...
...
@@ -179,7 +179,7 @@ internal abstract class EditAndContinueTestHelpers
var
newText
=
SourceText
.
From
(
newSource
);
var
diagnostics
=
new
List
<
RudeEditDiagnostic
>();
var
editMap
=
Analyzer
.
BuildEditMap
(
editScript
);
var
editMap
=
BuildEditMap
(
editScript
);
var
triviaEdits
=
new
List
<(
SyntaxNode
OldNode
,
SyntaxNode
NewNode
)>();
var
actualLineEdits
=
new
List
<
LineChange
>();
...
...
@@ -213,7 +213,7 @@ internal abstract class EditAndContinueTestHelpers
{
activeStatements
??=
ActiveStatementsDescription
.
Empty
;
var
editMap
=
Analyzer
.
BuildEditMap
(
editScript
);
var
editMap
=
BuildEditMap
(
editScript
);
var
oldRoot
=
editScript
.
Match
.
OldRoot
;
var
newRoot
=
editScript
.
Match
.
NewRoot
;
...
...
@@ -244,7 +244,7 @@ internal abstract class EditAndContinueTestHelpers
var
newModel
=
newCompilation
.
GetSemanticModel
(
newRoot
.
SyntaxTree
);
var
oldActiveStatements
=
activeStatements
.
OldStatements
.
AsImmutable
();
var
updatedActiveMethodMatches
=
new
List
<
AbstractEditAndContinueAnalyzer
.
UpdatedMemberInfo
>();
var
updatedActiveMethodMatches
=
new
List
<
UpdatedMemberInfo
>();
var
triviaEdits
=
new
List
<(
SyntaxNode
OldNode
,
SyntaxNode
NewNode
)>();
var
actualLineEdits
=
new
List
<
LineChange
>();
var
actualSemanticEdits
=
new
List
<
SemanticEdit
>();
...
...
@@ -365,8 +365,8 @@ private static string DisplaySpan(string source, TextSpan span)
internal
static
IEnumerable
<
KeyValuePair
<
SyntaxNode
,
SyntaxNode
>>
GetMethodMatches
(
AbstractEditAndContinueAnalyzer
analyzer
,
Match
<
SyntaxNode
>
bodyMatch
)
{
Dictionary
<
SyntaxNode
,
AbstractEditAndContinueAnalyzer
.
LambdaInfo
>
lazyActiveOrMatchedLambdas
=
null
;
var
map
=
analyzer
.
GetTestAccessor
().
ComputeMap
(
bodyMatch
,
Array
.
Empty
<
A
bstractEditAndContinueAnalyzer
.
A
ctiveNode
>(),
ref
lazyActiveOrMatchedLambdas
,
new
List
<
RudeEditDiagnostic
>());
Dictionary
<
SyntaxNode
,
LambdaInfo
>
lazyActiveOrMatchedLambdas
=
null
;
var
map
=
analyzer
.
GetTestAccessor
().
ComputeMap
(
bodyMatch
,
Array
.
Empty
<
ActiveNode
>(),
ref
lazyActiveOrMatchedLambdas
,
new
List
<
RudeEditDiagnostic
>());
var
result
=
new
Dictionary
<
SyntaxNode
,
SyntaxNode
>();
foreach
(
var
pair
in
map
.
Forward
)
...
...
src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs
浏览文件 @
855744d1
...
...
@@ -287,7 +287,7 @@ private IEnumerable<StatementSyntax> CleanupCode(IEnumerable<StatementSyntax> st
statements
=
postProcessor
.
RemoveRedundantBlock
(
statements
);
statements
=
postProcessor
.
RemoveDeclarationAssignmentPattern
(
statements
);
statements
=
p
ostProcessor
.
RemoveInitializedDeclarationAndReturnPattern
(
statements
);
statements
=
P
ostProcessor
.
RemoveInitializedDeclarationAndReturnPattern
(
statements
);
return
statements
;
}
...
...
src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs
浏览文件 @
855744d1
...
...
@@ -56,7 +56,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
var
(
matches
,
localName
)
=
CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer
.
Instance
.
AnalyzeExpression
(
semanticModel
,
isExpression
,
cancellationToken
);
var
updatedSemanticModel
=
CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer
.
Instance
.
ReplaceMatches
(
var
updatedSemanticModel
=
CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer
.
ReplaceMatches
(
semanticModel
,
isExpression
,
localName
,
matches
,
cancellationToken
);
var
updatedRoot
=
updatedSemanticModel
.
SyntaxTree
.
GetRoot
(
cancellationToken
);
...
...
src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs
浏览文件 @
855744d1
...
...
@@ -84,7 +84,7 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext context)
// See if this is an 'is' expression that would be handled by the analyzer. If so
// we don't need to do anything.
if
(
CSharpIsAndCastCheckDiagnosticAnalyzer
.
Instance
.
TryGetPatternPieces
(
if
(
CSharpIsAndCastCheckDiagnosticAnalyzer
.
TryGetPatternPieces
(
isExpression
,
out
_
,
out
_
,
out
_
,
out
_
))
{
return
;
...
...
src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs
浏览文件 @
855744d1
...
...
@@ -45,7 +45,7 @@ private class State
ContainingType
=
selectedMembers
[
0
].
ContainingType
;
var
rules
=
await
document
.
GetNamingRulesAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
parametersForSelectedMembers
=
service
.
DetermineParameters
(
selectedMembers
,
rules
);
var
parametersForSelectedMembers
=
DetermineParameters
(
selectedMembers
,
rules
);
if
(!
selectedMembers
.
All
(
IsWritableInstanceFieldOrProperty
)
||
ContainingType
==
null
||
...
...
src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs
浏览文件 @
855744d1
...
...
@@ -394,7 +394,7 @@ private async Task<ImmutableArray<SymbolReference>> GetReferencesForMatchingExte
ImmutableArray
<
SymbolResult
<
IMethodSymbol
>>
methodSymbols
,
ITypeSymbol
typeSymbol
)
{
return
GetViableExtensionMethodsWorker
(
methodSymbols
).
WhereAsArray
(
s
=>
_owner
.
IsViableExtensionMethod
(
s
.
Symbol
,
typeSymbol
));
s
=>
IsViableExtensionMethod
(
s
.
Symbol
,
typeSymbol
));
}
private
ImmutableArray
<
SymbolResult
<
IMethodSymbol
>>
GetViableExtensionMethodsWorker
(
...
...
src/Features/Core/Portable/ChangeSignature/ChangeSignatureCodeAction.cs
浏览文件 @
855744d1
...
...
@@ -26,7 +26,7 @@ public ChangeSignatureCodeAction(AbstractChangeSignatureService changeSignatureS
public
override
string
Title
=>
FeaturesResources
.
Change_signature
;
public
override
object
GetOptions
(
CancellationToken
cancellationToken
)
=>
_c
hangeSignatureService
.
GetChangeSignatureOptions
(
_context
)
=>
AbstractC
hangeSignatureService
.
GetChangeSignatureOptions
(
_context
)
??
new
ChangeSignatureOptionsResult
(
null
!,
false
);
protected
override
Task
<
IEnumerable
<
CodeActionOperation
>>
ComputeOperationsAsync
(
object
options
,
CancellationToken
cancellationToken
)
...
...
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs
浏览文件 @
855744d1
...
...
@@ -166,7 +166,7 @@ public Task DocumentResetAsync(Document document, CancellationToken cancellation
// let other components knows about this event
ClearCompilationsWithAnalyzersCache
();
var
documentHadDiagnostics
=
_s
tateManager
.
OnDocumentReset
(
stateSets
,
document
);
var
documentHadDiagnostics
=
S
tateManager
.
OnDocumentReset
(
stateSets
,
document
);
RaiseDiagnosticsRemovedIfRequiredForClosedOrResetDocument
(
document
,
stateSets
,
documentHadDiagnostics
);
}
...
...
@@ -201,7 +201,7 @@ public Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancell
// let other components knows about this event
ClearCompilationsWithAnalyzersCache
();
var
changed
=
_s
tateManager
.
OnDocumentRemoved
(
stateSets
,
documentId
);
var
changed
=
S
tateManager
.
OnDocumentRemoved
(
stateSets
,
documentId
);
// if there was no diagnostic reported for this document, nothing to clean up
// this is Perf to reduce raising events unnecessarily.
...
...
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs
浏览文件 @
855744d1
...
...
@@ -62,7 +62,7 @@ private class State
}
var
rules
=
await
document
.
GetNamingRulesAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
Parameters
=
service
.
DetermineParameters
(
selectedMembers
,
rules
);
Parameters
=
DetermineParameters
(
selectedMembers
,
rules
);
MatchingConstructor
=
GetMatchingConstructorBasedOnParameterTypes
(
ContainingType
,
Parameters
);
// We are going to create a new contructor and pass part of the parameters into DelegatedConstructor,
// so parameters should be compared based on types since we don't want get a type mismatch error after the new constructor is genreated.
...
...
src/Features/Core/Portable/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs
浏览文件 @
855744d1
...
...
@@ -72,7 +72,7 @@ private partial class State
cancellationToken
.
ThrowIfCancellationRequested
();
TypeToGenerateIn
=
await
SymbolFinder
.
FindSourceDefinitionAsync
(
TypeToGenerateIn
,
document
.
Project
.
Solution
,
cancellationToken
).
ConfigureAwait
(
false
)
as
INamedTypeSymbol
;
if
(!
service
.
ValidateTypeToGenerateIn
(
TypeToGenerateIn
,
true
,
EnumType
))
if
(!
ValidateTypeToGenerateIn
(
TypeToGenerateIn
,
true
,
EnumType
))
{
return
false
;
}
...
...
@@ -127,7 +127,7 @@ private partial class State
// Either we found no matches, or this was ambiguous. Either way, we might be able
// to generate a method here. Determine where the user wants to generate the method
// into, and if it's valid then proceed.
if
(!
service
.
TryDetermineTypeToGenerateIn
(
if
(!
TryDetermineTypeToGenerateIn
(
semanticDocument
,
containingType
,
simpleNameOrMemberAccessExpression
,
cancellationToken
,
out
var
typeToGenerateIn
,
out
var
isStatic
))
{
...
...
src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs
浏览文件 @
855744d1
...
...
@@ -199,7 +199,7 @@ internal new class State : AbstractGenerateParameterizedMemberService<TService,
// to generate a method here. Determine where the user wants to generate the method
// into, and if it's valid then proceed.
cancellationToken
.
ThrowIfCancellationRequested
();
if
(!
service
.
TryDetermineTypeToGenerateIn
(
if
(!
TryDetermineTypeToGenerateIn
(
semanticDocument
,
ContainingType
,
SimpleNameOrMemberAccessExpression
,
cancellationToken
,
out
var
typeToGenerateIn
,
out
var
isStatic
))
{
...
...
src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.State.cs
浏览文件 @
855744d1
...
...
@@ -61,7 +61,7 @@ protected async Task<bool> TryFinishInitializingStateAsync(TService service, Sem
return
false
;
}
if
(!
service
.
ValidateTypeToGenerateIn
(
TypeToGenerateIn
,
IsStatic
,
ClassInterfaceModuleStructTypes
))
if
(!
ValidateTypeToGenerateIn
(
TypeToGenerateIn
,
IsStatic
,
ClassInterfaceModuleStructTypes
))
{
return
false
;
}
...
...
src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs
浏览文件 @
855744d1
...
...
@@ -122,7 +122,7 @@ private partial class State
TypeToGenerateIn
=
await
SymbolFinder
.
FindSourceDefinitionAsync
(
TypeToGenerateIn
,
document
.
Project
.
Solution
,
cancellationToken
).
ConfigureAwait
(
false
)
as
INamedTypeSymbol
;
if
(!
service
.
ValidateTypeToGenerateIn
(
TypeToGenerateIn
,
IsStatic
,
ClassInterfaceModuleStructTypes
))
if
(!
ValidateTypeToGenerateIn
(
TypeToGenerateIn
,
IsStatic
,
ClassInterfaceModuleStructTypes
))
{
return
false
;
}
...
...
@@ -247,7 +247,7 @@ internal bool CanGenerateParameter()
// to generate a method here. Determine where the user wants to generate the method
// into, and if it's valid then proceed.
cancellationToken
.
ThrowIfCancellationRequested
();
if
(!
service
.
TryDetermineTypeToGenerateIn
(
semanticDocument
,
ContainingType
,
SimpleNameOrMemberAccessExpressionOpt
,
cancellationToken
,
if
(!
TryDetermineTypeToGenerateIn
(
semanticDocument
,
ContainingType
,
SimpleNameOrMemberAccessExpressionOpt
,
cancellationToken
,
out
var
typeToGenerateIn
,
out
var
isStatic
))
{
return
false
;
...
...
src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.State.cs
浏览文件 @
855744d1
...
...
@@ -300,7 +300,7 @@ private bool GenerateInterface(TService service)
// If we are generating in a website project, we also want to type to be public so the
// designer files can access the type.
if
(
documentToBeGeneratedIn
.
Project
!=
document
.
Project
||
service
.
GeneratedTypesMustBePublic
(
documentToBeGeneratedIn
.
Project
))
GeneratedTypesMustBePublic
(
documentToBeGeneratedIn
.
Project
))
{
IsPublicAccessibilityForTypeGeneration
=
true
;
}
...
...
src/Features/Core/Portable/ReplaceMethodWithProperty/AbstractReplaceMethodWithPropertyService.cs
浏览文件 @
855744d1
...
...
@@ -11,7 +11,9 @@ namespace Microsoft.CodeAnalysis.ReplaceMethodWithProperty
{
internal
abstract
class
AbstractReplaceMethodWithPropertyService
<
TMethodDeclarationSyntax
>
where
TMethodDeclarationSyntax
:
SyntaxNode
{
public
static
async
Task
<
SyntaxNode
>
GetMethodDeclarationAsync
(
CodeRefactoringContext
context
)
#pragma warning disable CA1822 // Mark members as static - implements interface method for sub-types.
public
async
Task
<
SyntaxNode
>
GetMethodDeclarationAsync
(
CodeRefactoringContext
context
)
#pragma warning restore CA1822 // Mark members as static
=>
await
context
.
TryGetRelevantNodeAsync
<
TMethodDeclarationSyntax
>().
ConfigureAwait
(
false
);
protected
static
string
GetWarning
(
GetAndSetMethods
getAndSetMethods
)
...
...
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContext.cs
浏览文件 @
855744d1
...
...
@@ -233,7 +233,7 @@ public FixAllContext WithCancellationToken(CancellationToken cancellationToken)
}
internal
Task
<
ImmutableDictionary
<
Document
,
ImmutableArray
<
Diagnostic
>>>
GetDocumentDiagnosticsToFixAsync
()
=>
State
.
DiagnosticProvider
.
GetDocumentDiagnosticsToFixAsync
(
this
);
=>
DiagnosticProvider
.
GetDocumentDiagnosticsToFixAsync
(
this
);
internal
Task
<
ImmutableDictionary
<
Project
,
ImmutableArray
<
Diagnostic
>>>
GetProjectDiagnosticsToFixAsync
()
=>
State
.
DiagnosticProvider
.
GetProjectDiagnosticsToFixAsync
(
this
);
...
...
src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
浏览文件 @
855744d1
...
...
@@ -342,7 +342,7 @@ public override SyntaxNode Apply(SyntaxNode root, SyntaxGenerator generator)
newNodes
[
i
]
=
_editor
.
ApplyTrackingToNewNode
(
newNodes
[
i
]);
}
return
g
enerator
.
ReplaceNode
(
root
,
current
,
newNodes
);
return
SyntaxG
enerator
.
ReplaceNode
(
root
,
current
,
newNodes
);
}
}
...
...
src/Workspaces/Core/Portable/Execution/SolutionSynchronizationService.cs
浏览文件 @
855744d1
...
...
@@ -47,7 +47,7 @@ public async ValueTask<PinnedRemotableDataScope> CreatePinnedRemotableDataScopeA
{
using
(
Logger
.
LogBlock
(
FunctionId
.
SolutionSynchronizationServiceFactory_CreatePinnedRemotableDataScopeAsync
,
cancellationToken
))
{
var
storage
=
_a
ssetStorages
.
CreateStorage
(
solution
.
State
);
var
storage
=
A
ssetStorages
.
CreateStorage
(
solution
.
State
);
var
checksum
=
await
solution
.
State
.
GetChecksumAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
return
PinnedRemotableDataScope
.
Create
(
_assetStorages
,
storage
,
checksum
);
...
...
src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs
浏览文件 @
855744d1
...
...
@@ -109,7 +109,7 @@ protected virtual SyntaxNode TransformReducedNode(SyntaxNode reducedNode, Syntax
// prep namespace imports marked for simplification
var
removeIfUnusedAnnotation
=
new
SyntaxAnnotation
();
var
originalRoot
=
root
;
root
=
this
.
PrepareNamespaceImportsForRemovalIfUnused
(
document
,
root
,
removeIfUnusedAnnotation
,
isNodeOrTokenOutsideSimplifySpans
);
root
=
PrepareNamespaceImportsForRemovalIfUnused
(
document
,
root
,
removeIfUnusedAnnotation
,
isNodeOrTokenOutsideSimplifySpans
);
var
hasImportsToSimplify
=
root
!=
originalRoot
;
if
(
hasImportsToSimplify
)
...
...
src/Workspaces/Core/Portable/SolutionCrawler/IIncrementalAnalyzerExtensions.cs
浏览文件 @
855744d1
...
...
@@ -12,9 +12,9 @@ internal static partial class IIncrementalAnalyzerExtensions
public
static
BackgroundAnalysisScope
GetOverriddenBackgroundAnalysisScope
(
this
IIncrementalAnalyzer
incrementalAnalyzer
,
OptionSet
options
,
BackgroundAnalysisScope
defaultBackgroundAnalysisScope
)
{
// Unit testing analyzer has special semantics for analysis scope.
if
(
incrementalAnalyzer
is
UnitTestingIncrementalAnalyzer
unitTestingAnalyzer
)
if
(
incrementalAnalyzer
is
UnitTestingIncrementalAnalyzer
)
{
return
unitTesting
Analyzer
.
GetBackgroundAnalysisScope
(
options
);
return
UnitTestingIncremental
Analyzer
.
GetBackgroundAnalysisScope
(
options
);
}
return
defaultBackgroundAnalysisScope
;
...
...
src/Workspaces/Core/Portable/Workspace/Workspace.cs
浏览文件 @
855744d1
...
...
@@ -1472,7 +1472,7 @@ protected virtual void ApplyProjectChanges(ProjectChanges projectChanges)
{
var
document
=
projectChanges
.
NewProject
.
GetDocument
(
documentId
)!;
var
text
=
document
.
GetTextSynchronously
(
CancellationToken
.
None
);
var
info
=
this
.
CreateDocumentInfoWithoutText
(
document
);
var
info
=
CreateDocumentInfoWithoutText
(
document
);
this
.
ApplyDocumentAdded
(
info
,
text
);
}
...
...
@@ -1481,7 +1481,7 @@ protected virtual void ApplyProjectChanges(ProjectChanges projectChanges)
{
var
document
=
projectChanges
.
NewProject
.
GetAdditionalDocument
(
documentId
)!;
var
text
=
document
.
GetTextSynchronously
(
CancellationToken
.
None
);
var
info
=
this
.
CreateDocumentInfoWithoutText
(
document
);
var
info
=
CreateDocumentInfoWithoutText
(
document
);
this
.
ApplyAdditionalDocumentAdded
(
info
,
text
);
}
...
...
@@ -1490,7 +1490,7 @@ protected virtual void ApplyProjectChanges(ProjectChanges projectChanges)
{
var
document
=
projectChanges
.
NewProject
.
GetAnalyzerConfigDocument
(
documentId
)!;
var
text
=
document
.
GetTextSynchronously
(
CancellationToken
.
None
);
var
info
=
this
.
CreateDocumentInfoWithoutText
(
document
);
var
info
=
CreateDocumentInfoWithoutText
(
document
);
this
.
ApplyAnalyzerConfigDocumentAdded
(
info
,
text
);
}
...
...
src/Workspaces/Remote/ServiceHub/Shared/RoslynJsonConverter.RoslynOnly.cs
浏览文件 @
855744d1
...
...
@@ -20,7 +20,12 @@ namespace Microsoft.CodeAnalysis.Remote
{
internal
partial
class
AggregateJsonConverter
:
JsonConverter
{
static
partial
void
AppendRoslynSpecificJsonConverters
(
ImmutableDictionary
<
Type
,
JsonConverter
>.
Builder
builder
)
#pragma warning disable CA1822 // Mark members as static
// this type is shared by multiple teams such as Razor, LUT and etc which have either
// separated/shared/shim repo so some types might not available to those context. this
// partial method let us add Roslyn specific types without breaking them
partial
void
AppendRoslynSpecificJsonConverters
(
ImmutableDictionary
<
Type
,
JsonConverter
>.
Builder
builder
)
#pragma warning restore CA1822 // Mark members as static
{
Add
(
builder
,
new
HighlightSpanJsonConverter
());
Add
(
builder
,
new
TaggedTextJsonConverter
());
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SpacingFormattingRule.cs
浏览文件 @
855744d1
...
...
@@ -162,7 +162,7 @@ public override AbstractFormattingRule WithOptions(AnalyzerConfigOptions options
// Semicolons in an empty for statement. i.e. for(;;)
if
(
previousParentKind
==
SyntaxKind
.
ForStatement
&&
this
.
IsEmptyForStatement
((
ForStatementSyntax
)
previousToken
.
Parent
!))
&&
IsEmptyForStatement
((
ForStatementSyntax
)
previousToken
.
Parent
!))
{
if
(
currentKind
==
SyntaxKind
.
SemicolonToken
&&
(
previousKind
!=
SyntaxKind
.
SemicolonToken
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.Rewriter.cs
浏览文件 @
855744d1
...
...
@@ -19,17 +19,14 @@ private class Rewriter : CSharpSyntaxRewriter
{
private
readonly
ISet
<
UsingDirectiveSyntax
>
_unnecessaryUsingsDoNotAccessDirectly
;
private
readonly
CancellationToken
_cancellationToken
;
private
readonly
CSharpRemoveUnnecessaryImportsService
_importsService
;
private
readonly
Document
_document
;
public
Rewriter
(
CSharpRemoveUnnecessaryImportsService
importsService
,
Document
document
,
ISet
<
UsingDirectiveSyntax
>
unnecessaryUsings
,
CancellationToken
cancellationToken
)
:
base
(
visitIntoStructuredTrivia
:
true
)
{
_importsService
=
importsService
;
_document
=
document
;
_unnecessaryUsingsDoNotAccessDirectly
=
unnecessaryUsings
;
_cancellationToken
=
cancellationToken
;
...
...
@@ -142,7 +139,7 @@ public override SyntaxNode VisitCompilationUnit(CompilationUnitSyntax node)
// We've removed all the usings and now the first thing in the namespace is a
// type. In this case, remove any newlines preceding the type.
var
firstToken
=
resultCompilationUnit
.
GetFirstToken
();
var
newFirstToken
=
_importsService
.
StripNewLines
(
_document
,
firstToken
);
var
newFirstToken
=
StripNewLines
(
_document
,
firstToken
);
resultCompilationUnit
=
resultCompilationUnit
.
ReplaceToken
(
firstToken
,
newFirstToken
);
}
...
...
@@ -176,7 +173,7 @@ public override SyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax
// We've removed all the usings and now the first thing in the namespace is a
// type. In this case, remove any newlines preceding the type.
var
firstToken
=
resultNamespace
.
Members
.
First
().
GetFirstToken
();
var
newFirstToken
=
_importsService
.
StripNewLines
(
_document
,
firstToken
);
var
newFirstToken
=
StripNewLines
(
_document
,
firstToken
);
resultNamespace
=
resultNamespace
.
ReplaceToken
(
firstToken
,
newFirstToken
);
}
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs
浏览文件 @
855744d1
...
...
@@ -53,7 +53,7 @@ protected override IUnnecessaryImportsProvider UnnecessaryImportsProvider
var
root
=
await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
oldRoot
=
(
CompilationUnitSyntax
)
root
;
var
newRoot
=
(
CompilationUnitSyntax
)
new
Rewriter
(
this
,
document
,
unnecessaryImports
,
cancellationToken
).
Visit
(
oldRoot
);
var
newRoot
=
(
CompilationUnitSyntax
)
new
Rewriter
(
document
,
unnecessaryImports
,
cancellationToken
).
Visit
(
oldRoot
);
cancellationToken
.
ThrowIfCancellationRequested
();
return
document
.
WithSyntaxRoot
(
await
FormatResultAsync
(
document
,
newRoot
,
cancellationToken
).
ConfigureAwait
(
false
));
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs
浏览文件 @
855744d1
...
...
@@ -500,19 +500,19 @@ private IEnumerable<TypeInferenceInfo> InferTypeInArgumentList(ArgumentListSynta
{
case
InvocationExpressionSyntax
invocation
:
{
var
index
=
this
.
GetArgumentListIndex
(
argumentList
,
previousToken
);
var
index
=
GetArgumentListIndex
(
argumentList
,
previousToken
);
return
InferTypeInInvocationExpression
(
invocation
,
index
);
}
case
ObjectCreationExpressionSyntax
objectCreation
:
{
var
index
=
this
.
GetArgumentListIndex
(
argumentList
,
previousToken
);
var
index
=
GetArgumentListIndex
(
argumentList
,
previousToken
);
return
InferTypeInObjectCreationExpression
(
objectCreation
,
index
);
}
case
ConstructorInitializerSyntax
constructorInitializer
:
{
var
index
=
this
.
GetArgumentListIndex
(
argumentList
,
previousToken
);
var
index
=
GetArgumentListIndex
(
argumentList
,
previousToken
);
return
InferTypeInConstructorInitializer
(
constructorInitializer
,
index
);
}
}
...
...
@@ -530,7 +530,7 @@ private IEnumerable<TypeInferenceInfo> InferTypeInAttributeArgumentList(Attribut
if
(
attributeArgumentList
.
Parent
is
AttributeSyntax
attribute
)
{
var
index
=
this
.
GetArgumentListIndex
(
attributeArgumentList
,
previousToken
);
var
index
=
GetArgumentListIndex
(
attributeArgumentList
,
previousToken
);
return
InferTypeInAttribute
(
attribute
,
index
);
}
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicRemoveUnnecessaryImportsService.Rewriter.vb
浏览文件 @
855744d1
...
...
@@ -14,14 +14,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryImports
Private
ReadOnly
_unnecessaryImports
As
ISet
(
Of
ImportsClauseSyntax
)
Private
ReadOnly
_cancellationToken
As
CancellationToken
Private
ReadOnly
_annotation
As
New
SyntaxAnnotation
()
Private
ReadOnly
_importsService
As
VisualBasicRemoveUnnecessaryImportsService
Private
ReadOnly
_document
As
Document
Public
Sub
New
(
importsService
As
VisualBasicRemoveUnnecessaryImportsService
,
document
As
Document
,
Public
Sub
New
(
document
As
Document
,
unnecessaryImports
As
ISet
(
Of
ImportsClauseSyntax
),
cancellationToken
As
CancellationToken
)
_importsService
=
importsService
_document
=
document
_unnecessaryImports
=
unnecessaryImports
_cancellationToken
=
cancellationToken
...
...
@@ -117,7 +114,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryImports
If
newCompilationUnit
.
Imports
.
Count
=
0
AndAlso
newCompilationUnit
.
Options
.
Count
=
0
Then
If
newCompilationUnit
.
Attributes
.
Count
>
0
OrElse
newCompilationUnit
.
Members
.
Count
>
0
Then
Dim
firstToken
=
newCompilationUnit
.
GetFirstToken
()
Dim
newFirstToken
=
_importsService
.
StripNewLines
(
_document
,
firstToken
)
Dim
newFirstToken
=
StripNewLines
(
_document
,
firstToken
)
newCompilationUnit
=
newCompilationUnit
.
ReplaceToken
(
firstToken
,
newFirstToken
)
End
If
End
If
...
...
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicRemoveUnnecessaryImportsService.vb
浏览文件 @
855744d1
...
...
@@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryImports
Dim
root
=
Await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
oldRoot
=
DirectCast
(
root
,
CompilationUnitSyntax
)
Dim
newRoot
=
New
Rewriter
(
Me
,
document
,
unnecessaryImports
,
cancellationToken
).
Visit
(
oldRoot
)
Dim
newRoot
=
New
Rewriter
(
document
,
unnecessaryImports
,
cancellationToken
).
Visit
(
oldRoot
)
newRoot
=
newRoot
.
WithAdditionalAnnotations
(
Formatter
.
Annotation
)
cancellationToken
.
ThrowIfCancellationRequested
()
...
...
src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicCodeGenerationService.vb
浏览文件 @
855744d1
...
...
@@ -48,7 +48,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Return
Nothing
End
Function
Private
Shared
Function
GetAvailableInsertionIndices
(
destination
As
CompilationUnitSyntax
,
cancellationToken
As
CancellationToken
)
As
IList
(
Of
Boolean
)
Private
Overloads
Shared
Function
GetAvailableInsertionIndices
(
destination
As
CompilationUnitSyntax
,
cancellationToken
As
CancellationToken
)
As
IList
(
Of
Boolean
)
Dim
members
=
destination
.
Members
Dim
indices
=
New
List
(
Of
Boolean
)
...
...
src/Workspaces/VisualBasic/Portable/Editing/VisualBasicImportAdder.vb
浏览文件 @
855744d1
...
...
@@ -41,7 +41,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Editing
Return
Rewriter
.
Visit
(
root
)
End
Function
Private
Shared
Function
GetExplicitNamespaceSymbol
(
fullName
As
ExpressionSyntax
,
namespacePart
As
ExpressionSyntax
,
model
As
SemanticModel
)
As
INamespaceSymbol
Private
Overloads
Shared
Function
GetExplicitNamespaceSymbol
(
fullName
As
ExpressionSyntax
,
namespacePart
As
ExpressionSyntax
,
model
As
SemanticModel
)
As
INamespaceSymbol
' name must refer to something that is not a namespace, but be qualified with a namespace.
Dim
Symbol
=
model
.
GetSymbolInfo
(
fullName
).
Symbol
Dim
nsSymbol
=
TryCast
(
model
.
GetSymbolInfo
(
namespacePart
).
Symbol
,
INamespaceSymbol
)
...
...
src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb
浏览文件 @
855744d1
...
...
@@ -92,7 +92,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation
AddIndentBlockOperations
(
list
,
parameterOrArgumentList
,
indentationDelta
)
End
Sub
Private
Shared
Sub
AddIndentBlockOperations
(
list
As
List
(
Of
IndentBlockOperation
),
parameterOrArgumentList
As
SyntaxNode
,
indentationDelta
As
Integer
)
Private
Overloads
Shared
Sub
AddIndentBlockOperations
(
list
As
List
(
Of
IndentBlockOperation
),
parameterOrArgumentList
As
SyntaxNode
,
indentationDelta
As
Integer
)
Dim
openBrace
=
parameterOrArgumentList
.
GetFirstToken
(
includeZeroWidth
:
=
True
)
Dim
closeBrace
=
parameterOrArgumentList
.
GetLastToken
(
includeZeroWidth
:
=
True
)
...
...
@@ -211,7 +211,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation
AddAlignTokensOperations
(
operations
,
baseToken
)
End
Sub
Private
Shared
Sub
AddAlignTokensOperations
(
operations
As
List
(
Of
AlignTokensOperation
),
baseToken
As
SyntaxToken
)
Private
Overloads
Shared
Sub
AddAlignTokensOperations
(
operations
As
List
(
Of
AlignTokensOperation
),
baseToken
As
SyntaxToken
)
operations
.
Add
(
FormattingOperations
.
CreateAlignTokensOperation
(
baseToken
,
SpecializedCollections
.
SingletonEnumerable
(
baseToken
.
GetNextToken
(
includeZeroWidth
:
=
True
)),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录