Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
bb77bfdf
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,发现更多精彩内容 >>
未验证
提交
bb77bfdf
编写于
12月 14, 2018
作者:
S
Sam Harwell
提交者:
GitHub
12月 14, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #31801 from sharwell/format-documents
Format documents in solution
上级
6574b776
33a9debb
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
39 addition
and
39 deletion
+39
-39
src/Compilers/CSharp/Portable/Binder/Binder_Constraints.cs
src/Compilers/CSharp/Portable/Binder/Binder_Constraints.cs
+1
-1
src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
+1
-1
src/EditorFeatures/CSharp/ExtractInterface/ExtractInterfaceCommandHandler.cs
...CSharp/ExtractInterface/ExtractInterfaceCommandHandler.cs
+1
-1
src/EditorFeatures/Core/Wrapping/AbstractCodeActionComputer.cs
...ditorFeatures/Core/Wrapping/AbstractCodeActionComputer.cs
+1
-1
src/EditorFeatures/Core/Wrapping/SeparatedSyntaxList/SeparatedSyntaxListCodeActionComputer.cs
...aratedSyntaxList/SeparatedSyntaxListCodeActionComputer.cs
+2
-2
src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpChangeNamespaceService.cs
...efactorings/SyncNamespace/CSharpChangeNamespaceService.cs
+4
-4
src/Features/CSharp/Portable/ExtractInterface/CSharpExtractInterfaceService.cs
...ortable/ExtractInterface/CSharpExtractInterfaceService.cs
+3
-3
src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractChangeNamespaceService.cs
...actorings/SyncNamespace/AbstractChangeNamespaceService.cs
+7
-7
src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.State.cs
...ace/AbstractSyncNamespaceCodeRefactoringProvider.State.cs
+4
-4
src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.cs
...Namespace/AbstractSyncNamespaceCodeRefactoringProvider.cs
+4
-4
src/Features/Core/Portable/ExtractInterface/AbstractExtractInterfaceService.SymbolMapping.cs
...nterface/AbstractExtractInterfaceService.SymbolMapping.cs
+3
-3
src/Features/Core/Portable/ExtractInterface/AbstractExtractInterfaceService.cs
...table/ExtractInterface/AbstractExtractInterfaceService.cs
+7
-7
src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs
...ces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Constraints.cs
浏览文件 @
bb77bfdf
...
...
@@ -133,7 +133,7 @@ internal partial class Binder
{
constraints
|=
TypeParameterConstraintKind
.
NotNullableReferenceType
;
}
else
else
{
constraints
|=
TypeParameterConstraintKind
.
ReferenceType
;
}
...
...
src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
浏览文件 @
bb77bfdf
...
...
@@ -3412,7 +3412,7 @@ private bool HasTopLevelNullabilityConversion(TypeSymbolWithAnnotations source,
if
(
isLiftedConversion
)
{
operandType
=
TypeSymbolWithAnnotations
.
Create
(
methodReturnType
.
IsValueType
&&
!
methodReturnType
.
IsNullableType
()
?
methodReturnType
.
IsValueType
&&
!
methodReturnType
.
IsNullableType
()
?
compilation
.
GetSpecialType
(
SpecialType
.
System_Nullable_T
).
Construct
(
ImmutableArray
.
Create
(
methodReturnType
))
:
methodReturnType
.
TypeSymbol
,
methodReturnType
.
NullableAnnotation
.
IsAnyNullable
()
||
operandAnnotation
.
IsAnyNullable
()
?
...
...
src/EditorFeatures/CSharp/ExtractInterface/ExtractInterfaceCommandHandler.cs
浏览文件 @
bb77bfdf
...
...
@@ -14,7 +14,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.ExtractInterface
internal
class
ExtractInterfaceCommandHandler
:
AbstractExtractInterfaceCommandHandler
{
[
ImportingConstructor
]
public
ExtractInterfaceCommandHandler
(
IThreadingContext
threadingContext
)
public
ExtractInterfaceCommandHandler
(
IThreadingContext
threadingContext
)
:
base
(
threadingContext
)
{
}
...
...
src/EditorFeatures/Core/Wrapping/AbstractCodeActionComputer.cs
浏览文件 @
bb77bfdf
...
...
@@ -224,7 +224,7 @@ private async Task<(SyntaxNode root, SyntaxNode rewrittenRoot, TextSpan spanToFo
}
return
newToken
;
},
},
trivia
:
null
,
computeReplacementTrivia
:
null
);
...
...
src/EditorFeatures/Core/Wrapping/SeparatedSyntaxList/SeparatedSyntaxListCodeActionComputer.cs
浏览文件 @
bb77bfdf
...
...
@@ -141,7 +141,7 @@ private async Task<WrappingGroup> GetUnwrapGroupAsync()
// MethodName(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
unwrapActions
.
Add
(
await
GetUnwrapAllCodeActionAsync
(
parentTitle
,
WrappingStyle
.
UnwrapFirst_IndentRest
).
ConfigureAwait
(
false
));
// MethodName(
// int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
unwrapActions
.
Add
(
await
GetUnwrapAllCodeActionAsync
(
parentTitle
,
WrappingStyle
.
WrapFirst_IndentRest
).
ConfigureAwait
(
false
));
...
...
@@ -157,7 +157,7 @@ private async Task<WrapItemsAction> GetUnwrapAllCodeActionAsync(string parentTit
var
title
=
wrappingStyle
==
WrappingStyle
.
WrapFirst_IndentRest
?
Wrapper
.
Unwrap_and_indent_all_items
:
Wrapper
.
Unwrap_all_items
;
return
await
TryCreateCodeActionAsync
(
edits
,
parentTitle
,
title
).
ConfigureAwait
(
false
);
}
...
...
src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpChangeNamespaceService.cs
浏览文件 @
bb77bfdf
...
...
@@ -201,8 +201,8 @@ protected override SyntaxList<MemberDeclarationSyntax> GetMemberDeclarationsInCo
/// namespace to global namespace (i.e. remove the namespace declaration).
/// </summary>
protected
override
CompilationUnitSyntax
ChangeNamespaceDeclaration
(
CompilationUnitSyntax
root
,
ImmutableArray
<
string
>
declaredNamespaceParts
,
CompilationUnitSyntax
root
,
ImmutableArray
<
string
>
declaredNamespaceParts
,
ImmutableArray
<
string
>
targetNamespaceParts
)
{
Debug
.
Assert
(!
declaredNamespaceParts
.
IsDefault
&&
!
targetNamespaceParts
.
IsDefault
);
...
...
@@ -225,7 +225,7 @@ protected override SyntaxList<MemberDeclarationSyntax> GetMemberDeclarationsInCo
// Change namespace name
return
root
.
ReplaceNode
(
namespaceDecl
,
namespaceDecl
,
namespaceDecl
.
WithName
(
CreateNameSyntax
(
targetNamespaceParts
,
aliasQualifier
:
null
,
targetNamespaceParts
.
Length
-
1
)
.
WithTriviaFrom
(
namespaceDecl
.
Name
).
WithAdditionalAnnotations
(
WarningAnnotation
))
...
...
@@ -349,7 +349,7 @@ protected override async Task<SyntaxNode> TryGetApplicableContainerFromSpanAsync
container
=
namespaceDecl
;
}
var
containsPartial
=
var
containsPartial
=
await
ContainsPartialTypeWithMultipleDeclarationsAsync
(
document
,
container
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
containsPartial
)
...
...
src/Features/CSharp/Portable/ExtractInterface/CSharpExtractInterfaceService.cs
浏览文件 @
bb77bfdf
...
...
@@ -70,9 +70,9 @@ internal override bool ShouldIncludeAccessibilityModifier(SyntaxNode typeNode)
}
protected
override
Task
<
Solution
>
UpdateMembersWithExplicitImplementationsAsync
(
Solution
unformattedSolution
,
IReadOnlyList
<
DocumentId
>
documentIds
,
INamedTypeSymbol
extractedInterface
,
INamedTypeSymbol
typeToExtractFrom
,
IEnumerable
<
ISymbol
>
includedMembers
,
Dictionary
<
ISymbol
,
SyntaxAnnotation
>
symbolToDeclarationMap
,
Solution
unformattedSolution
,
IReadOnlyList
<
DocumentId
>
documentIds
,
INamedTypeSymbol
extractedInterface
,
INamedTypeSymbol
typeToExtractFrom
,
IEnumerable
<
ISymbol
>
includedMembers
,
Dictionary
<
ISymbol
,
SyntaxAnnotation
>
symbolToDeclarationMap
,
CancellationToken
cancellationToken
)
{
// In C#, member implementations do not always need
...
...
src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractChangeNamespaceService.cs
浏览文件 @
bb77bfdf
...
...
@@ -99,12 +99,12 @@ public override async Task<bool> CanChangeNamespaceAsync(Document document, Synt
public
override
async
Task
<
Solution
>
ChangeNamespaceAsync
(
Document
document
,
SyntaxNode
container
,
string
targetNamespace
,
string
targetNamespace
,
CancellationToken
cancellationToken
)
{
// Make sure given namespace name is valid, "" means global namespace.
var
syntaxFacts
=
document
.
GetLanguageService
<
ISyntaxFactsService
>();
if
(
targetNamespace
==
null
if
(
targetNamespace
==
null
||
(
targetNamespace
.
Length
>
0
&&
!
targetNamespace
.
Split
(
s_dotSeparator
).
All
(
syntaxFacts
.
IsValidIdentifier
)))
{
throw
new
ArgumentException
(
nameof
(
targetNamespace
));
...
...
@@ -357,7 +357,7 @@ private static SyntaxNode CreateImport(SyntaxGenerator syntaxGenerator, string n
}
return
import
;
}
}
/// <summary>
/// Try to change the namespace declaration in the document (specified by <paramref name="id"/> in <paramref name="solution"/>).
...
...
@@ -365,10 +365,10 @@ private static SyntaxNode CreateImport(SyntaxGenerator syntaxGenerator, string n
/// the types declared in the changed namespace (not include the document contains the declaration itself).
/// </summary>
private
async
Task
<(
Solution
,
ImmutableArray
<
DocumentId
>)>
ChangeNamespaceInSingleDocumentAsync
(
Solution
solution
,
DocumentId
id
,
string
oldNamespace
,
string
newNamespace
,
Solution
solution
,
DocumentId
id
,
string
oldNamespace
,
string
newNamespace
,
CancellationToken
cancellationToken
)
{
var
document
=
solution
.
GetDocument
(
id
);
...
...
src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.State.cs
浏览文件 @
bb77bfdf
...
...
@@ -33,7 +33,7 @@ internal sealed class State
/// which will be used to change namespace.
/// </summary>
public
SyntaxNode
Container
{
get
;
}
/// <summary>
/// This is the new name we want to change the namespace to.
/// Empty string means global namespace, whereas null means change namespace action is not available.
...
...
@@ -51,7 +51,7 @@ internal sealed class State
private
State
(
Document
document
,
SyntaxNode
container
,
string
targetNamespace
,
string
targetNamespace
,
string
relativeDeclaredNamespace
)
{
Document
=
document
;
...
...
@@ -138,8 +138,8 @@ internal sealed class State
// For example, if the default namespace is `Microsoft.CodeAnalysis`, and declared
// namespace is `System.Diagnostics`, it's very likely this document is an outlier
// in the project and user probably has some special rule for it.
var
relativeNamespace
=
GetRelativeNamespace
(
defaultNamespace
,
declaredNamespace
,
syntaxFacts
);
var
relativeNamespace
=
GetRelativeNamespace
(
defaultNamespace
,
declaredNamespace
,
syntaxFacts
);
return
new
State
(
document
,
applicableNode
,
targetNamespace
,
relativeNamespace
);
}
...
...
src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.cs
浏览文件 @
bb77bfdf
...
...
@@ -47,7 +47,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
// No change namespace action if we can't construct a valid namespace from rootnamespace and folder names.
if
(
state
.
TargetNamespace
!=
null
)
{
{
// This code action tries to change the name of the namespace declaration to
// match the folder hierarchy of the document. The new namespace is constructed
// by concatenating the default namespace of the project and all the folders in
...
...
@@ -65,9 +65,9 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
var
service
=
document
.
GetLanguageService
<
IChangeNamespaceService
>();
var
solutionChangeAction
=
new
ChangeNamespaceCodeAction
(
state
.
TargetNamespace
.
Length
==
0
state
.
TargetNamespace
.
Length
==
0
?
FeaturesResources
.
Change_to_global_namespace
:
string
.
Format
(
FeaturesResources
.
Change_namespace_to_0
,
state
.
TargetNamespace
),
:
string
.
Format
(
FeaturesResources
.
Change_namespace_to_0
,
state
.
TargetNamespace
),
token
=>
service
.
ChangeNamespaceAsync
(
document
,
state
.
Container
,
state
.
TargetNamespace
,
token
));
context
.
RegisterRefactoring
(
solutionChangeAction
);
...
...
@@ -90,7 +90,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
private
class
ChangeNamespaceCodeAction
:
SolutionChangeAction
{
public
ChangeNamespaceCodeAction
(
string
title
,
Func
<
CancellationToken
,
Task
<
Solution
>>
createChangedSolution
)
:
public
ChangeNamespaceCodeAction
(
string
title
,
Func
<
CancellationToken
,
Task
<
Solution
>>
createChangedSolution
)
:
base
(
title
,
createChangedSolution
)
{
}
...
...
src/Features/Core/Portable/ExtractInterface/AbstractExtractInterfaceService.SymbolMapping.cs
浏览文件 @
bb77bfdf
...
...
@@ -9,9 +9,9 @@ internal abstract partial class AbstractExtractInterfaceService
private
readonly
struct
SymbolMapping
{
public
SymbolMapping
(
Dictionary
<
ISymbol
,
SyntaxAnnotation
>
symbolToDeclarationAnnotationMap
,
Solution
annotatedSolution
,
List
<
DocumentId
>
documentIds
,
Dictionary
<
ISymbol
,
SyntaxAnnotation
>
symbolToDeclarationAnnotationMap
,
Solution
annotatedSolution
,
List
<
DocumentId
>
documentIds
,
SyntaxAnnotation
typeNodeAnnotation
)
{
SymbolToDeclarationAnnotationMap
=
symbolToDeclarationAnnotationMap
;
...
...
src/Features/Core/Portable/ExtractInterface/AbstractExtractInterfaceService.cs
浏览文件 @
bb77bfdf
...
...
@@ -129,8 +129,8 @@ public async Task<ExtractInterfaceResult> ExtractInterfaceFromAnalyzedTypeAsync(
}
public
async
Task
<
ExtractInterfaceResult
>
ExtractInterfaceFromAnalyzedTypeAsync
(
ExtractInterfaceTypeAnalysisResult
refactoringResult
,
ExtractInterfaceOptionsResult
extractInterfaceOptions
,
ExtractInterfaceTypeAnalysisResult
refactoringResult
,
ExtractInterfaceOptionsResult
extractInterfaceOptions
,
CancellationToken
cancellationToken
)
{
var
solution
=
refactoringResult
.
DocumentToExtractFrom
.
Project
.
Solution
;
...
...
@@ -202,7 +202,7 @@ public async Task<ExtractInterfaceResult> ExtractInterfaceFromAnalyzedTypeAsync(
var
completedSolution
=
await
GetFormattedSolutionAsync
(
completedUnformattedSolution
,
symbolMapping
.
DocumentIds
.
Concat
(
unformattedInterfaceDocument
.
Id
),
symbolMapping
.
DocumentIds
.
Concat
(
unformattedInterfaceDocument
.
Id
),
cancellationToken
).
ConfigureAwait
(
false
);
return
new
ExtractInterfaceResult
(
...
...
@@ -249,8 +249,8 @@ public async Task<ExtractInterfaceResult> ExtractInterfaceFromAnalyzedTypeAsync(
extractInterfaceOptions
.
IncludedMembers
,
symbolMapping
.
SymbolToDeclarationAnnotationMap
,
cancellationToken
).
ConfigureAwait
(
false
);
var
completedSolution
=
await
GetFormattedSolutionAsync
(
unformattedSolutionWithUpdatedType
,
symbolMapping
.
DocumentIds
.
Concat
(
refactoringResult
.
DocumentToExtractFrom
.
Id
),
unformattedSolutionWithUpdatedType
,
symbolMapping
.
DocumentIds
.
Concat
(
refactoringResult
.
DocumentToExtractFrom
.
Id
),
cancellationToken
).
ConfigureAwait
(
false
);
return
new
ExtractInterfaceResult
(
...
...
@@ -366,8 +366,8 @@ private async Task<Solution> GetFormattedSolutionAsync(Solution unformattedSolut
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
var
simplifiedDocument
=
await
Simplifier
.
ReduceAsync
(
formattedDocument
,
Simplifier
.
Annotation
,
formattedDocument
,
Simplifier
.
Annotation
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
formattedSolution
=
simplifiedDocument
.
Project
.
Solution
;
...
...
src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs
浏览文件 @
bb77bfdf
...
...
@@ -257,7 +257,7 @@ private static ExpressionSyntax GenerateSingleLiteralExpression(ITypeSymbol type
return
result
;
}
}
var
negative
=
isNegative
(
value
);
var
nonNegativeValue
=
negative
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录