Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b394dee6
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,发现更多精彩内容 >>
提交
b394dee6
编写于
12月 20, 2018
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move files.
上级
014ff885
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
41 addition
and
41 deletion
+41
-41
src/EditorFeatures/CSharp/Wrapping/CSharpWrappingCodeRefactoringProvider.cs
.../CSharp/Wrapping/CSharpWrappingCodeRefactoringProvider.cs
+2
-2
src/EditorFeatures/CSharp/Wrapping/CallExpression/CSharpCallExpressionWrapper.cs
...rp/Wrapping/CallExpression/CSharpCallExpressionWrapper.cs
+4
-4
src/EditorFeatures/CSharpTest/Wrapping/BinaryExpressionWrappingTests.cs
...ures/CSharpTest/Wrapping/BinaryExpressionWrappingTests.cs
+1
-1
src/EditorFeatures/CSharpTest/Wrapping/CallExpressionWrappingTests.cs
...atures/CSharpTest/Wrapping/CallExpressionWrappingTests.cs
+1
-1
src/EditorFeatures/Core/Wrapping/CallExpression/AbstractCallExpressionWrapper.cs
.../Wrapping/CallExpression/AbstractCallExpressionWrapper.cs
+19
-19
src/EditorFeatures/Core/Wrapping/CallExpression/CallChunk.cs
src/EditorFeatures/Core/Wrapping/CallExpression/CallChunk.cs
+2
-2
src/EditorFeatures/Core/Wrapping/CallExpression/CallExpressionCodeActionComputer.cs
...apping/CallExpression/CallExpressionCodeActionComputer.cs
+6
-6
src/EditorFeatures/VisualBasic/Wrapping/CallExpression/VisualBasicCallExpressionWrapper.vb
...apping/CallExpression/VisualBasicCallExpressionWrapper.vb
+4
-4
src/EditorFeatures/VisualBasic/Wrapping/VisualBasicWrappingCodeRefactoringProvider.vb
...ic/Wrapping/VisualBasicWrappingCodeRefactoringProvider.vb
+2
-2
未找到文件。
src/EditorFeatures/CSharp/Wrapping/CSharpWrappingCodeRefactoringProvider.cs
浏览文件 @
b394dee6
...
...
@@ -5,7 +5,7 @@
using
Microsoft.CodeAnalysis.CodeRefactorings
;
using
Microsoft.CodeAnalysis.CSharp.Editor.Wrapping.SeparatedSyntaxList
;
using
Microsoft.CodeAnalysis.Editor.CSharp.Wrapping.BinaryExpression
;
using
Microsoft.CodeAnalysis.Editor.CSharp.Wrapping.Call
;
using
Microsoft.CodeAnalysis.Editor.CSharp.Wrapping.Call
Expression
;
using
Microsoft.CodeAnalysis.Editor.Wrapping
;
namespace
Microsoft.CodeAnalysis.Editor.CSharp.Wrapping
...
...
@@ -18,7 +18,7 @@ internal class CSharpWrappingCodeRefactoringProvider : AbstractWrappingCodeRefac
new
CSharpArgumentWrapper
(),
new
CSharpParameterWrapper
(),
new
CSharpBinaryExpressionWrapper
(),
new
CSharpCallWrapper
());
new
CSharpCall
Expression
Wrapper
());
public
CSharpWrappingCodeRefactoringProvider
()
:
base
(
s_wrappers
)
...
...
src/EditorFeatures/CSharp/Wrapping/Call
/CSharpCall
Wrapper.cs
→
src/EditorFeatures/CSharp/Wrapping/Call
Expression/CSharpCallExpression
Wrapper.cs
浏览文件 @
b394dee6
...
...
@@ -2,11 +2,11 @@
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
Microsoft.CodeAnalysis.Editor.Wrapping.Call
;
using
Microsoft.CodeAnalysis.Editor.Wrapping.Call
Expression
;
namespace
Microsoft.CodeAnalysis.Editor.CSharp.Wrapping.Call
namespace
Microsoft.CodeAnalysis.Editor.CSharp.Wrapping.Call
Expression
{
internal
class
CSharpCall
Wrapper
:
AbstractCall
Wrapper
<
internal
class
CSharpCall
ExpressionWrapper
:
AbstractCallExpression
Wrapper
<
ExpressionSyntax
,
NameSyntax
,
MemberAccessExpressionSyntax
,
...
...
@@ -14,7 +14,7 @@ internal class CSharpCallWrapper : AbstractCallWrapper<
ElementAccessExpressionSyntax
,
BaseArgumentListSyntax
>
{
public
CSharpCallWrapper
()
public
CSharpCall
Expression
Wrapper
()
:
base
(
CSharpSyntaxFactsService
.
Instance
)
{
}
...
...
src/EditorFeatures/CSharpTest/Wrapping/BinaryWrappingTests.cs
→
src/EditorFeatures/CSharpTest/Wrapping/Binary
Expression
WrappingTests.cs
浏览文件 @
b394dee6
...
...
@@ -11,7 +11,7 @@
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Wrapping
{
public
class
BinaryWrappingTests
:
AbstractWrappingTests
public
class
Binary
Expression
WrappingTests
:
AbstractWrappingTests
{
protected
override
CodeRefactoringProvider
CreateCodeRefactoringProvider
(
Workspace
workspace
,
TestParameters
parameters
)
=>
new
CSharpWrappingCodeRefactoringProvider
();
...
...
src/EditorFeatures/CSharpTest/Wrapping/CallWrappingTests.cs
→
src/EditorFeatures/CSharpTest/Wrapping/Call
Expression
WrappingTests.cs
浏览文件 @
b394dee6
...
...
@@ -8,7 +8,7 @@
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Wrapping
{
public
class
CallWrappingTests
:
AbstractWrappingTests
public
class
Call
Expression
WrappingTests
:
AbstractWrappingTests
{
protected
override
CodeRefactoringProvider
CreateCodeRefactoringProvider
(
Workspace
workspace
,
TestParameters
parameters
)
=>
new
CSharpWrappingCodeRefactoringProvider
();
...
...
src/EditorFeatures/Core/Wrapping/Call
s/AbstractCall
Wrapper.cs
→
src/EditorFeatures/Core/Wrapping/Call
Expression/AbstractCallExpression
Wrapper.cs
浏览文件 @
b394dee6
...
...
@@ -6,9 +6,9 @@
using
Microsoft.CodeAnalysis.LanguageServices
;
using
Microsoft.CodeAnalysis.PooledObjects
;
namespace
Microsoft.CodeAnalysis.Editor.Wrapping.Call
namespace
Microsoft.CodeAnalysis.Editor.Wrapping.Call
Expression
{
internal
abstract
partial
class
AbstractCallWrapper
:
AbstractSyntaxWrapper
internal
abstract
partial
class
AbstractCall
Expression
Wrapper
:
AbstractSyntaxWrapper
{
/// <summary>
/// Gets the language specific trivia that should be inserted before an operator if the
...
...
@@ -32,10 +32,10 @@ internal abstract partial class AbstractCallWrapper : AbstractSyntaxWrapper
/// .P3.I1[...]
/// </c>
///
/// Note: for the sake of simplicity, from now on, every time
an invocation is
///
referred to,
it means either an InvocationExpression or an ElementAccessExpression.
/// Note: for the sake of simplicity, from now on, every time
we talk about a CallExpression,
/// it means either an InvocationExpression or an ElementAccessExpression.
///
/// The way this wrapper works is breaking up a long dotted expression into 'call-chunks'
/// The way this wrapper works is breaking up a long dotted
call
expression into 'call-chunks'
/// of the form `.P1.P2.P3.M(...)` i.e. a *non-empty* sequence of dot-and-name pairs
/// followed by one or more ArgumentLists. In this example the sequence is considered:
///
...
...
@@ -60,13 +60,13 @@ internal abstract partial class AbstractCallWrapper : AbstractSyntaxWrapper
/// 'wrap long', then the wrapping only occurs if the current call-chunk's end
/// would go past the preferred wrapping column
/// </summary>
internal
abstract
partial
class
AbstractCallWrapper
<
internal
abstract
partial
class
AbstractCall
Expression
Wrapper
<
TExpressionSyntax
,
TNameSyntax
,
TMemberAccessExpressionSyntax
,
TInvocationExpressionSyntax
,
TElementAccessExpressionSyntax
,
TBaseArgumentListSyntax
>
:
AbstractCallWrapper
TBaseArgumentListSyntax
>
:
AbstractCall
Expression
Wrapper
where
TExpressionSyntax
:
SyntaxNode
where
TNameSyntax
:
TExpressionSyntax
where
TMemberAccessExpressionSyntax
:
TExpressionSyntax
...
...
@@ -76,7 +76,7 @@ internal abstract partial class AbstractCallWrapper<
{
private
readonly
ISyntaxFactsService
_syntaxFacts
;
protected
AbstractCallWrapper
(
protected
AbstractCall
Expression
Wrapper
(
ISyntaxFactsService
syntaxFacts
)
{
_syntaxFacts
=
syntaxFacts
;
...
...
@@ -86,13 +86,13 @@ internal abstract partial class AbstractCallWrapper<
Document
document
,
int
position
,
SyntaxNode
node
,
CancellationToken
cancellationToken
)
{
// has to either be `expr(...)` or `expr[...]`
if
(!
Is
InvocationOrElementAccess
Expression
(
node
))
if
(!
Is
Call
Expression
(
node
))
{
return
null
;
}
// Has to be the topmost invocation/element-access.
if
(
Is
InvocationOrElementAccess
Expression
(
node
.
Parent
))
if
(
Is
Call
Expression
(
node
.
Parent
))
{
return
null
;
}
...
...
@@ -107,7 +107,7 @@ internal abstract partial class AbstractCallWrapper<
return
null
;
}
// Don't process this
invocation
expression if it's contained in some higher member
// Don't process this
call
expression if it's contained in some higher member
// call-chunk expression. We'll take care of this when we hit the parent.
var
current
=
node
;
while
(
current
.
Parent
is
TMemberAccessExpressionSyntax
)
...
...
@@ -115,7 +115,7 @@ internal abstract partial class AbstractCallWrapper<
current
=
current
.
Parent
;
}
if
(
Is
InvocationOrElementAccess
Expression
(
current
.
Parent
))
if
(
Is
Call
Expression
(
current
.
Parent
))
{
return
null
;
}
...
...
@@ -150,17 +150,17 @@ internal abstract partial class AbstractCallWrapper<
// the set of wrapping options to provide.
var
sourceText
=
await
document
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
options
=
await
document
.
GetOptionsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
return
new
CallCodeActionComputer
(
return
new
Call
Expression
CodeActionComputer
(
this
,
document
,
sourceText
,
options
,
callChunks
,
cancellationToken
);
}
private
bool
Is
InvocationOrElementAccess
Expression
(
SyntaxNode
node
)
=>
Is
InvocationOrElementAccess
Expression
(
node
,
out
_
,
out
_
);
private
bool
Is
Call
Expression
(
SyntaxNode
node
)
=>
Is
Call
Expression
(
node
,
out
_
,
out
_
);
private
bool
Is
InvocationOrElementAccess
Expression
(
private
bool
Is
Call
Expression
(
SyntaxNode
node
,
out
TExpressionSyntax
expression
,
out
TBaseArgumentListSyntax
argumentList
)
{
if
(
Is
InvocationOrElementAccess
ExpressionWorker
(
if
(
Is
Call
ExpressionWorker
(
node
,
out
var
expressionNode
,
out
var
argumentListNode
))
{
expression
=
(
TExpressionSyntax
)
expressionNode
;
...
...
@@ -173,7 +173,7 @@ private bool IsInvocationOrElementAccessExpression(SyntaxNode node)
return
false
;
}
private
bool
Is
InvocationOrElementAccess
ExpressionWorker
(
private
bool
Is
Call
ExpressionWorker
(
SyntaxNode
node
,
out
SyntaxNode
expression
,
out
SyntaxNode
argumentList
)
{
if
(
node
is
TInvocationExpressionSyntax
)
...
...
@@ -208,7 +208,7 @@ private void AddChunks(SyntaxNode node, ArrayBuilder<CallChunk> chunks)
// Walk downwards, consuming argument lists.
// Note: because of how we walk down, the arg lists will be reverse order.
// We take care of that below.
while
(
Is
InvocationOrElementAccess
Expression
(
node
,
out
var
expression
,
out
var
argumentList
))
while
(
Is
Call
Expression
(
node
,
out
var
expression
,
out
var
argumentList
))
{
argumentLists
.
Add
(
argumentList
);
node
=
expression
;
...
...
src/EditorFeatures/Core/Wrapping/Call
s
/CallChunk.cs
→
src/EditorFeatures/Core/Wrapping/Call
Expression
/CallChunk.cs
浏览文件 @
b394dee6
...
...
@@ -6,9 +6,9 @@
using
System.Linq
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
namespace
Microsoft.CodeAnalysis.Editor.Wrapping.Call
namespace
Microsoft.CodeAnalysis.Editor.Wrapping.Call
Expression
{
internal
abstract
partial
class
AbstractCallWrapper
<
internal
abstract
partial
class
AbstractCall
Expression
Wrapper
<
TExpressionSyntax
,
TNameSyntax
,
TMemberAccessExpressionSyntax
,
...
...
src/EditorFeatures/Core/Wrapping/Call
s/Call
CodeActionComputer.cs
→
src/EditorFeatures/Core/Wrapping/Call
Expression/CallExpression
CodeActionComputer.cs
浏览文件 @
b394dee6
...
...
@@ -11,9 +11,9 @@
using
Microsoft.CodeAnalysis.Text
;
using
Microsoft.CodeAnalysis.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.Wrapping.Call
namespace
Microsoft.CodeAnalysis.Editor.Wrapping.Call
Expression
{
internal
abstract
partial
class
AbstractCallWrapper
<
internal
abstract
partial
class
AbstractCall
Expression
Wrapper
<
TExpressionSyntax
,
TNameSyntax
,
TMemberAccessExpressionSyntax
,
...
...
@@ -34,8 +34,8 @@ internal abstract partial class AbstractCallWrapper<
/// if wrap-long produces the same results as wrap-each, then the caller will
/// filter it out.
/// </summary>
private
class
CallCodeActionComputer
:
AbstractCodeActionComputer
<
AbstractCallWrapper
>
private
class
Call
Expression
CodeActionComputer
:
AbstractCodeActionComputer
<
AbstractCall
Expression
Wrapper
>
{
/// <summary>
/// The chunks to normalize and wrap. The first chunk will be normalized,
...
...
@@ -56,8 +56,8 @@ private class CallCodeActionComputer :
/// </summary>
private
readonly
SyntaxTriviaList
_newlineBeforeOperatorTrivia
;
public
CallCodeActionComputer
(
AbstractCallWrapper
service
,
public
Call
Expression
CodeActionComputer
(
AbstractCall
Expression
Wrapper
service
,
Document
document
,
SourceText
originalSourceText
,
DocumentOptionSet
options
,
...
...
src/EditorFeatures/VisualBasic/Wrapping/Call
/VisualBasicCall
Wrapper.vb
→
src/EditorFeatures/VisualBasic/Wrapping/Call
Expression/VisualBasicCallExpression
Wrapper.vb
浏览文件 @
b394dee6
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports
Microsoft.CodeAnalysis.Editor.Wrapping.Call
Imports
Microsoft.CodeAnalysis.Editor.Wrapping.Call
Expression
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace
Microsoft.CodeAnalysis.Editor.VisualBasic.Wrapping.Call
Friend
Class
VisualBasicCallWrapper
Inherits
AbstractCallWrapper
(
Of
Namespace
Microsoft.CodeAnalysis.Editor.VisualBasic.Wrapping.Call
Expression
Friend
Class
VisualBasicCall
Expression
Wrapper
Inherits
AbstractCall
Expression
Wrapper
(
Of
ExpressionSyntax
,
NameSyntax
,
MemberAccessExpressionSyntax
,
...
...
src/EditorFeatures/VisualBasic/Wrapping/VisualBasicWrappingCodeRefactoringProvider.vb
浏览文件 @
b394dee6
...
...
@@ -4,7 +4,7 @@ Imports System.Collections.Immutable
Imports
System.Composition
Imports
Microsoft.CodeAnalysis.CodeRefactorings
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.Wrapping.BinaryExpression
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.Wrapping.Call
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.Wrapping.Call
Expression
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.Wrapping.SeparatedSyntaxList
Imports
Microsoft.CodeAnalysis.Editor.Wrapping
...
...
@@ -18,7 +18,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Wrapping
New
VisualBasicArgumentWrapper
(),
New
VisualBasicParameterWrapper
(),
New
VisualBasicBinaryExpressionWrapper
(),
New
VisualBasicCallWrapper
())
New
VisualBasicCall
Expression
Wrapper
())
Public
Sub
New
()
MyBase
.
New
(
s_wrappers
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录