Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8bb2349d
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,发现更多精彩内容 >>
提交
8bb2349d
编写于
3月 20, 2015
作者:
R
Ravi Chande
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
No conditional access completion on types
Fixes #33
上级
1a4bbb67
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
104 addition
and
19 deletion
+104
-19
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
...tion/CompletionProviders/SymbolCompletionProviderTests.cs
+40
-0
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/SymbolCompletionProviderTests.vb
...tion/CompletionProviders/SymbolCompletionProviderTests.vb
+47
-19
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
...p/Portable/Recommendations/CSharpRecommendationService.cs
+8
-0
src/Workspaces/VisualBasic/Portable/Recommendations/VisualBasicRecommendationService.vb
...table/Recommendations/VisualBasicRecommendationService.vb
+9
-0
未找到文件。
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
浏览文件 @
8bb2349d
...
...
@@ -7945,5 +7945,45 @@ class A {
"
;
VerifyItemExists
(
markup
,
"s_abc"
);
}
[
WorkItem
(
33
,
"https://github.com/dotnet/roslyn/issues/33"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
void
NoConditionalAccessCompletionOnTypes1
()
{
var
markup
=
@"
using A = System
class C
{
A?.$$
}
"
;
VerifyNoItemsExist
(
markup
);
}
[
WorkItem
(
33
,
"https://github.com/dotnet/roslyn/issues/33"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
void
NoConditionalAccessCompletionOnTypes2
()
{
var
markup
=
@"
class C
{
System?.$$
}
"
;
VerifyNoItemsExist
(
markup
);
}
[
WorkItem
(
33
,
"https://github.com/dotnet/roslyn/issues/33"
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
void
NoConditionalAccessCompletionOnTypes3
()
{
var
markup
=
@"
class C
{
System.Console?.$$
}
"
;
VerifyNoItemsExist
(
markup
);
}
}
}
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/SymbolCompletionProviderTests.vb
浏览文件 @
8bb2349d
...
...
@@ -5289,7 +5289,7 @@ End Class
<
WorkItem
(
1041269
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Sub
Unwrap
NullableForConditionalAccess
()
Public
Sub
NullableForConditionalAccess
()
Dim
text
=
<
code
><
!
[
CDATA
[
Class
C
...
...
@@ -5392,24 +5392,6 @@ End Module
VerifyItemExists
(
text
,
"ToString"
)
End
Sub
<
WorkItem
(
1079716
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Sub
DontThrowForNullPropagatingOperatorAfterNamespace
()
Dim
text
=
<
code
><
!
[
CDATA
[
Option Strict On
Module
Program
Sub
Main
()
System
?
.
$$
End
Sub
End
Module
]]></
code
>
.
Value
' NOTE: The current behavior is that we'll still show types for a namespace after ?.
' While the code is not correct, it seems reasonable to allow the user to continue typing.
VerifyItemExists
(
text
,
"Action"
)
End
Sub
<
WorkItem
(
1079723
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Sub
AllowCompletionAfterNullPropagatingOperatingInWithBlock
()
...
...
@@ -5835,5 +5817,51 @@ End Class
VerifyItemExists(text, "
M
", usePreviousCharAsTrigger:=True)
End Sub
<WorkItem(33, "
https
:
//
github
.
com
/
dotnet
/
roslyn
/
issues
/
33
")>
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Sub NoCompletionForConditionalAccessOnTypes1()
Dim text =
<code><![CDATA[
Module Program
Sub Main(args As String())
System?.$$
End Sub
End Module
]]></code>.Value
VerifyNoItemsExist(text)
End Sub
<WorkItem(33, "
https
:
//
github
.
com
/
dotnet
/
roslyn
/
issues
/
33
")>
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Sub NoCompletionForConditionalAccessOnTypes2()
Dim text =
<code><![CDATA[
Module Program
Sub Main(args As String())
Console?.$$
End Sub
End Module
]]></code>.Value
VerifyNoItemsExist(text)
End Sub
<WorkItem(33, "
https
:
//
github
.
com
/
dotnet
/
roslyn
/
issues
/
33
")>
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Sub NoCompletionForConditionalAccessOnTypes3()
Dim text =
<code><![CDATA[
Imports a = System
Module Program
Sub Main(args As String())
a?.$$
End Sub
End Module
]]></code>.Value
VerifyNoItemsExist(text)
End Sub
End Class
End Namespace
\ No newline at end of file
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
浏览文件 @
8bb2349d
...
...
@@ -398,6 +398,14 @@ internal class CSharpRecommendationService : AbstractRecommendationService
var
expression
=
originalExpression
.
WalkDownParentheses
();
var
leftHandBinding
=
context
.
SemanticModel
.
GetSymbolInfo
(
expression
,
cancellationToken
);
var
container
=
context
.
SemanticModel
.
GetTypeInfo
(
expression
,
cancellationToken
).
Type
.
RemoveNullableIfPresent
();
// If the thing on the left is a type, namespace, or alias, we shouldn't show anything in
// IntelliSense.
if
(
leftHandBinding
.
GetBestOrAllSymbols
().
FirstOrDefault
().
MatchesKind
(
SymbolKind
.
NamedType
,
SymbolKind
.
Namespace
,
SymbolKind
.
Alias
))
{
return
SpecializedCollections
.
EmptyEnumerable
<
ISymbol
>();
}
return
GetSymbolsOffOfBoundExpression
(
context
,
originalExpression
,
expression
,
leftHandBinding
,
container
,
cancellationToken
);
}
...
...
src/Workspaces/VisualBasic/Portable/Recommendations/VisualBasicRecommendationService.vb
浏览文件 @
8bb2349d
...
...
@@ -224,6 +224,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
Dim
firstSymbol
=
leftHandBinding
.
Symbol
Select
Case
firstSymbol
.
Kind
Case
SymbolKind
.
TypeParameter
' 884060: We don't allow invocations off type parameters.
...
...
@@ -278,6 +281,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
End
If
End
If
' No completion on types/namespace after conditional access
If
leftExpression
.
Parent
.
IsKind
(
SyntaxKind
.
ConditionalAccessExpression
)
AndAlso
(
couldBeMergedNamespace
OrElse
leftHandBinding
.
GetBestOrAllSymbols
().
FirstOrDefault
().
MatchesKind
(
SymbolKind
.
NamedType
,
SymbolKind
.
Namespace
,
SymbolKind
.
Alias
))
Then
Return
SpecializedCollections
.
EmptyCollection
(
Of
ISymbol
)()
End
If
Dim
position
=
node
.
SpanStart
Dim
symbols
As
IEnumerable
(
Of
ISymbol
)
If
couldBeMergedNamespace
Then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录