Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
accff1e2
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,发现更多精彩内容 >>
提交
accff1e2
编写于
3月 18, 2017
作者:
L
lorcanmooney
提交者:
Sam Harwell
8月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add typeparamref completion element for containing elements
Fixes #17872
上级
803b5a60
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
104 addition
and
48 deletion
+104
-48
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs
...oviders/XmlDocumentationCommentCompletionProviderTests.cs
+51
-25
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb
...mpletionProviders/XmlDocCommentCompletionProviderTests.vb
+33
-21
src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs
...pletion/Providers/AbstractDocCommentCompletionProvider.cs
+7
-2
src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
...aces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
+13
-0
未找到文件。
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs
浏览文件 @
accff1e2
...
...
@@ -327,13 +327,16 @@ public class goo
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
MethodParamTypeParam
()
{
await
VerifyItemsExistAsync
(
@"
public class goo<T>
var
text
=
@"
public class goo<T
Goo
>
{
/// $$
public int bar<T>(T green) { }
}"
,
"typeparam name=\"T\""
,
"param name=\"green\""
);
public int bar<TBar>(TBar green) { }
}"
;
await
VerifyItemsExistAsync
(
text
,
"typeparam name=\"TBar\""
,
"param name=\"green\""
);
await
VerifyItemsAbsentAsync
(
text
,
"typeparam name=\"TGoo\""
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -348,18 +351,27 @@ public class goo<T>
}"
,
"param name=\"green\""
);
}
[
WorkItem
(
17872
,
"https://github.com/dotnet/roslyn/issues/17872"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
MethodParamRefName
()
{
await
VerifyItemsExistAsync
(
@"
public class
goo<T
>
var
text
=
@"
public class
Outer<TOuter
>
{
/// <summary>
/// $$
/// </summary>
public int bar<T>(T green) { }
}"
,
"typeparamref name=\"T\""
,
"paramref name=\"green\""
);
public class Inner<TInner>
{
/// <summary>
/// $$
/// </summary>
public int Method<TMethod>(T green) { }
}
}"
;
await
VerifyItemsExistAsync
(
text
,
"typeparamref name=\"TOuter\""
,
"typeparamref name=\"TInner\""
,
"typeparamref name=\"TMethod\""
,
"paramref name=\"green\""
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -1172,28 +1184,42 @@ static void Goo(string str)
"
,
"str"
);
}
[
WorkItem
(
17872
,
"https://github.com/dotnet/roslyn/issues/17872"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TypeParamRefNames
()
{
await
VerifyItemExistsAsync
(
@"
/// <summary>
/// <typeparamref name=""$$""/>
/// </summary>
static void Goo<T>()
var
text
=
@"
public class Outer<TOuter>
{
}
"
,
"T"
);
public class Inner<TInner>
{
/// <summary>
/// <typeparamref name=""$$""/>
/// </summary>
public int Method<TMethod>(T green) { }
}
}"
;
await
VerifyItemsExistAsync
(
text
,
"TOuter"
,
"TInner"
,
"TMethod"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TypeParamNames
()
{
await
VerifyItemExistsAsync
(
@"
/// <typeparam name=""$$""/>
static void Goo<T>()
var
text
=
@"
public class Outer<TOuter>
{
}
"
,
"T"
);
public class Inner<TInner>
{
/// <summary>
/// <typeparam name=""$$""/>
/// </summary>
public int Method<TMethod>(T green) { }
}
}"
;
await
VerifyItemsExistAsync
(
text
,
"TMethod"
);
await
VerifyItemsAbsentAsync
(
text
,
"TOuter"
,
"TInner"
);
}
[
WorkItem
(
8322
,
"https://github.com/dotnet/roslyn/issues/8322"
)]
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb
浏览文件 @
accff1e2
...
...
@@ -112,19 +112,27 @@ End Class
Await
VerifyItemsExistAsync
(
text
,
"code"
,
"list"
,
"para"
)
End
Function
<
WorkItem
(
17872
,
"https://github.com/dotnet/roslyn/issues/17872"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Async
Function
TestRepeatableNestedParamRefAndTypeParamRefTagsOnMethod
()
As
Task
Dim
text
=
"
Class C
''' <summary>
''' <$$
''' </summary>
Sub Goo(Of T)(i as Integer)
End Sub
Class Outer(Of TOuter)
Class Inner(Of TInner)
''' <summary>
''' $$
''' </summary>
Sub Goo(Of TMethod)(i as Integer)
End Sub
End Class
End Class
"
Await
VerifyItemsExistAsync
(
text
,
"paramref name=
""
i
""
"
,
"typeparamref name=
""
T
""
"
)
Await
VerifyItemsExistAsync
(
text
,
"paramref name=
""
i
""
"
,
"typeparamref name=
""
TOuter
""
"
,
"typeparamref name=
""
TInner
""
"
,
"typeparamref name=
""
TMethod
""
"
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
...
...
@@ -239,14 +247,15 @@ End Class
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Async
Function
TestMethodParamTypeParam
()
As
Task
Dim
text
=
"
Class C(Of T)
Class C(Of T
Class
)
''' <$$
Sub Goo(Of T
)(bar as T
)
Sub Goo(Of T
Method)(bar as TMethod
)
End Sub
End Class
"
Await
VerifyItemsExistAsync
(
text
,
"param name=
""
bar
""
"
,
"typeparam name=
""
T
""
"
)
Await
VerifyItemsExistAsync
(
text
,
"param name=
""
bar
""
"
,
"typeparam name=
""
TMethod
""
"
)
Await
VerifyItemsAbsentAsync
(
text
,
"typeparam name=
""
TClass
""
"
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
...
...
@@ -799,28 +808,31 @@ End Class
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Async
Function
TestTypeParamNames
()
As
Task
Dim
text
=
"
Class C
Class C
(Of TClass)
''' <typeparam name=
""
$$
""
Sub Goo(Of T
)(i as Integer
)
Sub Goo(Of T
Method)(i as TMethod
)
End Sub
End Class
"
Await
VerifyItemsExistAsync
(
text
,
"T"
)
Await
VerifyItemsAbsentAsync
(
text
,
"i"
)
Await
VerifyItemsExistAsync
(
text
,
"T
Method
"
)
Await
VerifyItemsAbsentAsync
(
text
,
"
TClass"
,
"
i"
)
End
Function
<
WorkItem
(
17872
,
"https://github.com/dotnet/roslyn/issues/17872"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Async
Function
TestTypeParamRefNames
()
As
Task
Dim
text
=
"
Class C
''' <summary>
''' <typeparamref name=
""
$$
""
''' </summary>
Sub Goo(Of T)(i as Integer)
End Sub
Class Outer(Of TOuter)
Class Inner(Of TInner)
''' <summary>
''' <typeparamref name=
""
$$
""
''' </summary>
Sub Goo(Of TMethod)(i as Integer)
End Sub
End Class
End Class
"
Await
VerifyItemsExistAsync
(
text
,
"T"
)
Await
VerifyItemsExistAsync
(
text
,
"T
Outer"
,
"TInner"
,
"TMethod
"
)
Await
VerifyItemsAbsentAsync
(
text
,
"i"
)
End
Function
...
...
src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs
浏览文件 @
accff1e2
...
...
@@ -149,7 +149,7 @@ private IEnumerable<CompletionItem> GetParamRefItems(ISymbol symbol)
private
IEnumerable
<
CompletionItem
>
GetTypeParamRefItems
(
ISymbol
symbol
)
{
var
names
=
symbol
.
GetTypeParameters
().
Select
(
t
=>
t
.
Name
);
var
names
=
symbol
.
Get
All
TypeParameters
().
Select
(
t
=>
t
.
Name
);
return
names
.
Select
(
t
=>
CreateCompletionItem
(
displayText
:
FormatParameter
(
TypeParameterReferenceElementName
,
t
),
...
...
@@ -166,11 +166,16 @@ protected IEnumerable<CompletionItem> GetAttributeValueItems(ISymbol symbol, str
return
symbol
.
GetParameters
()
.
Select
(
parameter
=>
CreateCompletionItem
(
parameter
.
Name
));
}
else
if
(
tagName
==
TypeParameterElementName
||
tagName
==
TypeParameterReferenceElementName
)
else
if
(
tagName
==
TypeParameterElementName
)
{
return
symbol
.
GetTypeParameters
()
.
Select
(
typeParameter
=>
CreateCompletionItem
(
typeParameter
.
Name
));
}
else
if
(
tagName
==
TypeParameterReferenceElementName
)
{
return
symbol
.
GetAllTypeParameters
()
.
Select
(
typeParameter
=>
CreateCompletionItem
(
typeParameter
.
Name
));
}
}
else
if
(
attributeName
==
LangwordAttributeName
&&
tagName
==
SeeElementName
)
{
...
...
src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
浏览文件 @
accff1e2
...
...
@@ -425,6 +425,19 @@ public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbo
}
}
public
static
ImmutableArray
<
ITypeParameterSymbol
>
GetAllTypeParameters
(
this
ISymbol
symbol
)
{
var
results
=
ArrayBuilder
<
ITypeParameterSymbol
>.
GetInstance
();
while
(
symbol
!=
null
)
{
results
.
AddRange
(
symbol
.
GetTypeParameters
());
symbol
=
symbol
.
ContainingType
;
}
return
results
.
ToImmutableAndFree
();
}
public
static
ImmutableArray
<
ITypeSymbol
>
GetTypeArguments
(
this
ISymbol
symbol
)
{
switch
(
symbol
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录