Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
f74d5081
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,发现更多精彩内容 >>
提交
f74d5081
编写于
9月 11, 2015
作者:
D
Dustin Campbell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Final bit of clean up to C# and VB cref completion
上级
a4a3c451
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
39 deletion
+42
-39
src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs
.../Completion/CompletionProviders/CrefCompletionProvider.cs
+5
-5
src/Features/VisualBasic/Portable/Completion/CompletionProviders/CrefCompletionProvider.vb
.../Completion/CompletionProviders/CrefCompletionProvider.vb
+37
-34
未找到文件。
src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs
浏览文件 @
f74d5081
...
...
@@ -88,7 +88,7 @@ public override async Task ProduceCompletionListAsync(CompletionListContext cont
var
text
=
await
document
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
filterSpan
=
GetTextChangeSpan
(
text
,
position
);
var
items
=
Create
Items
(
document
.
Project
.
Solution
.
Workspace
,
semanticModel
,
symbols
,
token
,
filterSpan
,
cancellationToke
n
);
var
items
=
Create
CompletionItems
(
document
.
Project
.
Solution
.
Workspace
,
semanticModel
,
symbols
,
token
,
filterSpa
n
);
context
.
AddItems
(
items
);
}
...
...
@@ -222,8 +222,8 @@ private static TextSpan GetTextChangeSpan(SourceText text, int position)
(
ch
)
=>
CompletionUtilities
.
IsWordCharacter
(
ch
)
||
ch
==
'{'
||
ch
==
'}'
);
}
private
IEnumerable
<
CompletionItem
>
CreateItems
(
Workspace
workspace
,
SemanticModel
semanticModel
,
IEnumerable
<
ISymbol
>
symbols
,
SyntaxToken
token
,
TextSpan
filterSpan
,
CancellationToken
cancellationToken
)
private
IEnumerable
<
CompletionItem
>
Create
Completion
Items
(
Workspace
workspace
,
SemanticModel
semanticModel
,
IEnumerable
<
ISymbol
>
symbols
,
SyntaxToken
token
,
TextSpan
filterSpan
)
{
var
builder
=
SharedPools
.
Default
<
StringBuilder
>().
Allocate
();
try
...
...
@@ -231,7 +231,7 @@ private static TextSpan GetTextChangeSpan(SourceText text, int position)
foreach
(
var
symbol
in
symbols
)
{
builder
.
Clear
();
yield
return
CreateItem
(
workspace
,
semanticModel
,
symbol
,
token
,
filterSpan
,
builder
,
cancellationToken
);
yield
return
CreateItem
(
workspace
,
semanticModel
,
symbol
,
token
,
filterSpan
,
builder
);
}
}
finally
...
...
@@ -241,7 +241,7 @@ private static TextSpan GetTextChangeSpan(SourceText text, int position)
}
private
CompletionItem
CreateItem
(
Workspace
workspace
,
SemanticModel
semanticModel
,
ISymbol
symbol
,
SyntaxToken
token
,
TextSpan
filterSpan
,
StringBuilder
builder
,
CancellationToken
cancellationToken
)
Workspace
workspace
,
SemanticModel
semanticModel
,
ISymbol
symbol
,
SyntaxToken
token
,
TextSpan
filterSpan
,
StringBuilder
builder
)
{
int
position
=
token
.
SpanStart
;
...
...
src/Features/VisualBasic/Portable/Completion/CompletionProviders/CrefCompletionProvider.vb
浏览文件 @
f74d5081
...
...
@@ -38,7 +38,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Return
End
If
If
IsTypeParameterContext
(
token
)
Then
If
Is
Cref
TypeParameterContext
(
token
)
Then
Return
End
If
...
...
@@ -60,7 +60,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Dim
text
=
Await
document
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
filterSpan
=
CompletionUtilities
.
GetTextChangeSpan
(
text
,
position
)
Dim
items
=
CreateCompletionItems
(
symbols
,
filterSpan
,
semanticModel
,
workspace
,
token
.
SpanStart
)
Dim
items
=
CreateCompletionItems
(
workspace
,
semanticModel
,
symbols
,
token
.
SpanStart
,
filterSpan
)
context
.
AddItems
(
items
)
If
IsFirstCrefParameterContext
(
token
)
Then
...
...
@@ -71,10 +71,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
context
.
MakeExclusive
(
True
)
End
Function
Private
Function
Is
TypeParameterContext
(
token
As
SyntaxToken
)
As
Boolean
Private
Shared
Function
IsCref
TypeParameterContext
(
token
As
SyntaxToken
)
As
Boolean
Return
(
token
.
IsChildToken
(
Function
(
t
As
TypeArgumentListSyntax
)
t
.
OfKeyword
)
OrElse
token
.
IsChildSeparatorToken
(
Function
(
t
As
TypeArgumentListSyntax
)
t
.
Arguments
))
AndAlso
token
.
GetAncestor
(
Of
XmlCrefAttributeSyntax
)()
IsNot
Nothing
token
.
Parent
?
.
FirstAncestorOrSelf
(
Of
XmlCrefAttributeSyntax
)()
IsNot
Nothing
End
Function
Private
Shared
Function
IsCrefStartContext
(
token
As
SyntaxToken
)
As
Boolean
...
...
@@ -144,51 +144,54 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
End
If
End
Function
Private
Iterator
Function
CreateCompletionItems
(
symbols
As
IEnumerable
(
Of
ISymbol
),
filterSpan
As
TextSpan
,
semanticModel
As
SemanticModel
,
workspace
As
Workspace
,
position
As
Integer
)
As
IEnumerable
(
Of
CompletionItem
)
Private
Iterator
Function
CreateCompletionItems
(
workspace
As
Workspace
,
semanticModel
As
SemanticModel
,
symbols
As
IEnumerable
(
Of
ISymbol
),
position
As
Integer
,
filterSpan
As
TextSpan
)
As
IEnumerable
(
Of
CompletionItem
)
Dim
builder
=
SharedPools
.
Default
(
Of
StringBuilder
).
Allocate
()
Try
For
Each
symbol
In
symbols
builder
.
Clear
()
Yield
CreateCompletionItem
(
workspace
,
semanticModel
,
symbol
,
position
,
filterSpan
,
builder
)
Next
Finally
SharedPools
.
Default
(
Of
StringBuilder
).
ClearAndFree
(
builder
)
End
Try
End
Function
If
symbol
.
IsUserDefinedOperator
()
Then
builder
.
Append
(
"Operator "
)
End
If
Private
Function
CreateCompletionItem
(
workspace
As
Workspace
,
semanticModel
As
SemanticModel
,
symbol
As
ISymbol
,
position
As
Integer
,
filterSpan
As
TextSpan
,
builder
As
StringBuilder
)
As
CompletionItem
If
symbol
.
IsUserDefinedOperator
()
Then
builder
.
Append
(
"Operator "
)
End
If
builder
.
Append
(
symbol
.
ToDisplayString
(
CrefFormat
))
builder
.
Append
(
symbol
.
ToDisplayString
(
CrefFormat
))
Dim
parameters
=
symbol
.
GetParameters
()
Dim
parameters
=
symbol
.
GetParameters
()
If
Not
parameters
.
IsDefaultOrEmpty
Then
builder
.
Append
(
"("
c
)
If
Not
parameters
.
IsDefaultOrEmpty
Then
builder
.
Append
(
"("
c
)
For
i
=
0
To
parameters
.
Length
-
1
If
i
>
0
Then
builder
.
Append
(
", "
)
End
If
For
i
=
0
To
parameters
.
Length
-
1
If
i
>
0
Then
builder
.
Append
(
", "
)
End
If
Dim
parameter
=
parameters
(
i
)
Dim
parameter
=
parameters
(
i
)
If
parameter
.
RefKind
=
RefKind
.
Ref
Then
builder
.
Append
(
"ByRef "
)
End
If
If
parameter
.
RefKind
=
RefKind
.
Ref
Then
builder
.
Append
(
"ByRef "
)
End
If
builder
.
Append
(
parameter
.
Type
.
ToMinimalDisplayString
(
semanticModel
,
position
))
Next
builder
.
Append
(
parameter
.
Type
.
ToMinimalDisplayString
(
semanticModel
,
position
))
Next
builder
.
Append
(
")"
c
)
ElseIf
symbol
.
Kind
=
SymbolKind
.
Method
builder
.
Append
(
"()"
)
End
If
builder
.
Append
(
")"
c
)
ElseIf
symbol
.
Kind
=
SymbolKind
.
Method
builder
.
Append
(
"()"
)
End
If
Dim
displayString
=
builder
.
ToString
()
Dim
displayString
=
builder
.
ToString
()
Yield
New
CompletionItem
(
Me
,
displayString
,
filterSpan
,
glyph
:
=
symbol
.
GetGlyph
(),
descriptionFactory
:
=
CommonCompletionUtilities
.
CreateDescriptionFactory
(
workspace
,
semanticModel
,
position
,
symbol
),
rules
:
=
ItemRules
.
Instance
)
Next
Finally
SharedPools
.
Default
(
Of
StringBuilder
).
ClearAndFree
(
builder
)
End
Try
Return
New
CompletionItem
(
Me
,
displayString
,
filterSpan
,
glyph
:
=
symbol
.
GetGlyph
(),
descriptionFactory
:
=
CommonCompletionUtilities
.
CreateDescriptionFactory
(
workspace
,
semanticModel
,
position
,
symbol
),
rules
:
=
ItemRules
.
Instance
)
End
Function
Private
Function
CreateOfCompletionItem
(
span
As
TextSpan
)
As
CompletionItem
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录