Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2892bc6c
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,发现更多精彩内容 >>
提交
2892bc6c
编写于
4月 30, 2019
作者:
I
Ivan Basov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Code review feedback
上级
d4aef3f6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
69 addition
and
2 deletion
+69
-2
src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/ItemManager.cs
...mplementation/IntelliSense/AsyncCompletion/ItemManager.cs
+2
-2
src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests.vb
...Test2/IntelliSense/CSharpCompletionCommandHandlerTests.vb
+67
-0
未找到文件。
src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/ItemManager.cs
浏览文件 @
2892bc6c
...
...
@@ -269,6 +269,7 @@ private static bool IsAfterDot(ITextSnapshot snapshot, ITrackingSpan applicableT
// Ask the language to determine which of the *matched* items it wants to select.
var
matchingItems
=
itemsInList
.
Where
(
r
=>
r
.
FilterResult
.
MatchedFilterText
)
.
Select
(
t
=>
t
.
FilterResult
.
CompletionItem
)
.
Where
(
r
=>
!
r
.
DisplayText
.
StartsWith
(
"★"
))
.
AsImmutable
();
var
chosenItems
=
filterMethod
(
matchingItems
,
filterText
);
...
...
@@ -291,8 +292,7 @@ private static bool IsAfterDot(ITextSnapshot snapshot, ITrackingSpan applicableT
{
selectedItemIndex
=
itemsInList
.
IndexOf
(
i
=>
Equals
(
i
.
FilterResult
.
CompletionItem
,
bestItem
));
if
(
selectedItemIndex
>
-
1
&&
bestItem
!=
null
&&
matchingItems
.
Where
(
r
=>
!
r
.
DisplayText
.
StartsWith
(
"★"
)).
Count
()
==
1
&&
matchingItems
.
Length
==
1
&&
filterText
.
Length
>
0
)
{
uniqueItem
=
highlightedList
[
selectedItemIndex
].
CompletionItem
;
...
...
src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests.vb
浏览文件 @
2892bc6c
...
...
@@ -4851,6 +4851,55 @@ class C
End
Using
End
Function
' Implementation for the Modern completion only
<
InlineData
(
CompletionImplementation
.
Modern
)
>
<
WpfTheory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Async
Function
TestSendCommitIfUniqueWithIntelliCodeAndDuplicateItemsFromIntelliCode
(
completionImplementation
As
CompletionImplementation
)
As
Task
Dim
provider
=
New
IntelliCodeMockWeirdProvider
()
Using
state
=
TestStateFactory
.
CreateCSharpTestState
(
completionImplementation
,
<
Document
>
class
C
{
void
Method
()
{
var
s
=
""
;
s
.
Len
$$
}
}
</
Document
>
,
{
provider
})
state
.
SendCommitUniqueCompletionListItem
()
Await
state
.
AssertNoCompletionSession
()
Assert
.
Contains
(
"s.Length"
,
state
.
GetLineTextFromCaretPosition
(),
StringComparison
.
Ordinal
)
End
Using
End
Function
' Implementation for the Modern completion only
<
InlineData
(
CompletionImplementation
.
Modern
)
>
<
WpfTheory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Async
Function
TestSendCommitIfUniqueInInsertionSessionWithIntelliCodeAndDuplicateItemsFromIntelliCode
(
completionImplementation
As
CompletionImplementation
)
As
Task
Dim
provider
=
New
IntelliCodeMockWeirdProvider
()
Using
state
=
TestStateFactory
.
CreateCSharpTestState
(
completionImplementation
,
<
Document
>
class
C
{
void
Method
()
{
var
s
=
""
;
s$
$
}
}
</
Document
>
,
{
provider
})
state
.
SendTypeChars
(
".len"
)
Await
state
.
AssertCompletionSession
()
state
.
AssertCompletionItemsContainAll
({
"Length"
,
"★ Length3"
,
"★ Length2"
})
state
.
SendCommitUniqueCompletionListItem
()
Await
state
.
AssertNoCompletionSession
()
Assert
.
Contains
(
"s.Length"
,
state
.
GetLineTextFromCaretPosition
(),
StringComparison
.
Ordinal
)
End
Using
End
Function
Private
Class
MultipleChangeCompletionProvider
Inherits
CompletionProvider
...
...
@@ -4903,5 +4952,23 @@ class C
Return
True
End
Function
End
Class
' Simulates a situation where IntelliCode provides items not included into the Rolsyn original list.
' We want to ignore these items in CommitIfUnique.
' This situation should not happen. Tests with this provider were added to cover protective scenarios.
Private
Class
IntelliCodeMockWeirdProvider
Inherits
CompletionProvider
Public
Overrides
Function
ProvideCompletionsAsync
(
context
As
CompletionContext
)
As
Task
context
.
AddItem
(
CompletionItem
.
Create
(
displayText
:
=
"★ Length2"
,
filterText
:
=
"Length2"
))
context
.
AddItem
(
CompletionItem
.
Create
(
displayText
:
=
"Length"
,
filterText
:
=
"Length"
))
context
.
AddItem
(
CompletionItem
.
Create
(
displayText
:
=
"★ Length3"
,
filterText
:
=
"Length3"
))
Return
Task
.
CompletedTask
End
Function
Public
Overrides
Function
ShouldTriggerCompletion
(
text
As
SourceText
,
caretPosition
As
Integer
,
trigger
As
CompletionTrigger
,
options
As
OptionSet
)
As
Boolean
Return
True
End
Function
End
Class
End
Class
End
Namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录