Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d3445d79
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,发现更多精彩内容 >>
提交
d3445d79
编写于
7月 09, 2019
作者:
P
Petr Houska
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add GetStartNodeExcludingAttributes helper.
上级
77366a4b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
16 deletion
+22
-16
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+4
-8
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs
...Services/SyntaxFactsService/AbstractSyntaxFactsService.cs
+11
-0
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
...ortable/LanguageServices/VisualBasicSyntaxFactsService.vb
+7
-8
未找到文件。
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
浏览文件 @
d3445d79
...
...
@@ -1795,8 +1795,7 @@ public bool IsOnTypeHeader(SyntaxNode root, int position)
return
false
;
}
var
start
=
typeDecl
.
AttributeLists
.
LastOrDefault
()?.
GetLastToken
().
GetNextToken
().
SpanStart
??
typeDecl
.
SpanStart
;
var
start
=
GetStartOfNodeExcludingAttributes
(
typeDecl
);
var
end
=
typeDecl
.
GetTypeParameterList
()?.
GetLastToken
().
FullSpan
.
End
??
typeDecl
.
Identifier
.
FullSpan
.
End
;
...
...
@@ -1810,9 +1809,7 @@ public bool IsInPropertyDeclarationHeader(SyntaxNode node)
{
return
false
;
}
var
start
=
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()?.
GetLastToken
().
GetNextToken
().
SpanStart
??
propertyDeclaration
.
SpanStart
;
var
start
=
GetStartOfNodeExcludingAttributes
(
propertyDeclaration
);
var
end
=
propertyDeclaration
.
Identifier
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
...
...
@@ -1826,8 +1823,7 @@ public bool IsInParameterHeader(SyntaxNode node)
return
false
;
}
var
start
=
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()?.
GetLastToken
().
GetNextToken
().
SpanStart
??
propertyDeclaration
.
SpanStart
;
var
start
=
GetStartOfNodeExcludingAttributes
(
propertyDeclaration
);
var
end
=
propertyDeclaration
.
Identifier
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
...
...
@@ -1973,6 +1969,6 @@ public void GetPartsOfCastExpression(SyntaxNode node, out SyntaxNode type, out S
public
SyntaxNode
GetContainingParameter
(
SyntaxNode
node
)
=>
node
.
GetAncestorOrThis
<
ParameterSyntax
>();
public
SyntaxList
<
SyntaxNode
>
GetAttributeLists
(
SyntaxNode
node
)
=>
CSharpSyntaxGenerator
.
GetAttributeLists
(
node
);
public
override
SyntaxList
<
SyntaxNode
>
GetAttributeLists
(
SyntaxNode
node
)
=>
CSharpSyntaxGenerator
.
GetAttributeLists
(
node
);
}
}
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs
浏览文件 @
d3445d79
...
...
@@ -487,5 +487,16 @@ public bool SpansPreprocessorDirective(IEnumerable<SyntaxToken> tokens)
private
bool
SpansPreprocessorDirective
(
SyntaxTriviaList
list
)
=>
list
.
Any
(
t
=>
IsPreprocessorDirective
(
t
));
protected
int
GetStartOfNodeExcludingAttributes
(
SyntaxNode
node
)
{
var
attributeLists
=
GetAttributeLists
(
node
);
var
start
=
attributeLists
.
LastOrDefault
()?.
GetLastToken
().
GetNextToken
().
SpanStart
??
node
.
SpanStart
;
return
start
;
}
public
abstract
SyntaxList
<
SyntaxNode
>
GetAttributeLists
(
SyntaxNode
node
);
}
}
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
浏览文件 @
d3445d79
...
...
@@ -1746,8 +1746,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
Nothing
End
If
Dim
start
=
If
(
statement
.
AttributeLists
.
LastOrDefault
()
?
.
GetLastToken
().
GetNextToken
().
SpanStart
,
statement
.
SpanStart
)
Dim
start
=
GetStartOfNodeExcludingAttributes
(
statement
)
Dim
_end
=
If
(
statement
.
TypeParameterList
?
.
GetLastToken
().
FullSpan
.
End
,
statement
.
Identifier
.
FullSpan
.
End
)
...
...
@@ -1761,20 +1760,20 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
False
End
If
Dim
start
=
If
(
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()
?
.
GetLastToken
().
GetNextToken
().
SpanStart
,
propertyDeclaration
.
SpanStart
)
Dim
start
=
GetStartOfNodeExcludingAttributes
(
propertyDeclaration
)
Dim
[
end
]
=
If
(
propertyDeclaration
.
AsClause
?
.
FullSpan
.
[
End
]
,
propertyDeclaration
.
Identifier
.
FullSpan
.
End
)
Return
node
.
Span
.
Start
>=
start
AndAlso
node
.
Span
.
[
End
]
<=
[
end
]
End
Function
Public
Function
IsInParameterHeader
(
node
As
SyntaxNode
)
As
Boolean
Implements
ISyntaxFactsService
.
IsInParameterHeader
Dim
p
ropertyDeclaration
=
node
.
GetAncestor
(
Of
ParameterSyntax
)()
Dim
p
arameter
=
node
.
GetAncestor
(
Of
ParameterSyntax
)()
If
p
ropertyDeclaration
Is
Nothing
Then
If
p
arameter
Is
Nothing
Then
Return
False
End
If
Dim
start
=
If
(
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()
?
.
GetLastToken
().
GetNextToken
().
SpanStart
,
propertyDeclaration
.
SpanStart
)
Dim
[
end
]
=
If
(
p
ropertyDeclaration
.
AsClause
?
.
FullSpan
.
[
End
]
,
propertyDeclaration
.
Identifier
.
FullSpan
.
End
)
Dim
start
=
GetStartOfNodeExcludingAttributes
(
parameter
)
Dim
[
end
]
=
If
(
p
arameter
.
AsClause
?
.
FullSpan
.
[
End
]
,
parameter
.
Identifier
.
FullSpan
.
End
)
Return
node
.
Span
.
Start
>=
start
AndAlso
node
.
Span
.
[
End
]
<=
[
end
]
End
Function
...
...
@@ -1977,7 +1976,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
node
.
GetAncestorOrThis
(
Of
ParameterSyntax
)
End
Function
Public
Function
GetAttributeLists
(
node
As
SyntaxNode
)
As
SyntaxList
(
Of
SyntaxNode
)
Implements
ISyntaxFactsService
.
GetAttributeLists
Public
Overrides
Function
GetAttributeLists
(
node
As
SyntaxNode
)
As
SyntaxList
(
Of
SyntaxNode
)
Implements
ISyntaxFactsService
.
GetAttributeLists
Return
VisualBasicSyntaxGenerator
.
GetAttributeLists
(
node
)
End
Function
End
Class
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录