Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
638a818a
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,发现更多精彩内容 >>
未验证
提交
638a818a
编写于
10月 24, 2019
作者:
I
Ivan Basov
提交者:
GitHub
10月 24, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Variable suggestions show duplicated filter buttons on completion window (#39499)
上级
a1638e3b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
6 deletion
+21
-6
src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/FilterSet.cs
.../Implementation/IntelliSense/AsyncCompletion/FilterSet.cs
+18
-6
src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
...stUtilities/Completion/AbstractCompletionProviderTests.cs
+3
-0
未找到文件。
src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/FilterSet.cs
浏览文件 @
638a818a
...
...
@@ -25,10 +25,16 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncComplet
internal
sealed
class
FilterSet
{
// Cache all the VS completion filters which essentially make them singletons.
// Because all items that should be filtered using the same filter button must
// use the same reference to the instance of CompletionFilter.
// Need to map item tags such as Class, Interface, Local, Enum to filter buttons.
// There can be tags mapping to the same button:
// Local -> Locals and Parameters, Parameter -> Locals and Parameters.
private
static
readonly
ImmutableDictionary
<
string
,
FilterWithMask
>
s_filterMap
;
// Distinct list of all filters.
// Need to iterate over a distinct list of filters
// to create a filter list covering a completion session.
private
static
readonly
ImmutableArray
<
FilterWithMask
>
s_filters
;
private
BitVector32
_vector
;
private
static
readonly
int
s_expanderMask
;
...
...
@@ -54,7 +60,9 @@ internal sealed class FilterSet
static
FilterSet
()
{
var
builder
=
ImmutableDictionary
.
CreateBuilder
<
string
,
FilterWithMask
>();
var
mapBuilder
=
ImmutableDictionary
.
CreateBuilder
<
string
,
FilterWithMask
>();
var
arrayBuilder
=
ImmutableArray
.
CreateBuilder
<
FilterWithMask
>();
var
previousMask
=
0
;
NamespaceFilter
=
CreateCompletionFilterAndAddToBuilder
(
FeaturesResources
.
Namespaces
,
'n'
,
WellKnownTags
.
Namespace
);
...
...
@@ -75,7 +83,8 @@ static FilterSet()
SnippetFilter
=
CreateCompletionFilterAndAddToBuilder
(
FeaturesResources
.
Snippets
,
't'
,
WellKnownTags
.
Snippet
);
TargetTypedFilter
=
CreateCompletionFilterAndAddToBuilder
(
FeaturesResources
.
Target_type_matches
,
'j'
,
WellKnownTags
.
TargetTypeMatch
);
s_filterMap
=
builder
.
ToImmutable
();
s_filterMap
=
mapBuilder
.
ToImmutable
();
s_filters
=
arrayBuilder
.
ToImmutable
();
s_expanderMask
=
BitVector32
.
CreateMask
(
previousMask
);
...
...
@@ -91,9 +100,12 @@ CompletionFilter CreateCompletionFilterAndAddToBuilder(string displayText, char
var
filter
=
CreateCompletionFilter
(
displayText
,
tags
,
accessKey
);
previousMask
=
BitVector32
.
CreateMask
(
previousMask
);
var
filterWithMask
=
new
FilterWithMask
(
filter
,
previousMask
);
arrayBuilder
.
Add
(
filterWithMask
);
foreach
(
var
tag
in
tags
)
{
builder
.
Add
(
tag
,
new
FilterWithMask
(
filter
,
previousMask
)
);
mapBuilder
.
Add
(
tag
,
filterWithMask
);
}
return
filter
;
...
...
@@ -173,7 +185,7 @@ public ImmutableArray<CompletionFilterWithState> GetFilterStatesInSet(bool addUn
builder
.
Add
(
new
CompletionFilterWithState
(
Expander
,
isAvailable
:
true
,
isSelected
:
false
));
}
foreach
(
var
filterWithMask
in
s_filter
Map
.
Value
s
)
foreach
(
var
filterWithMask
in
s_filters
)
{
if
(
_vector
[
filterWithMask
.
Mask
])
{
...
...
src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
浏览文件 @
638a818a
...
...
@@ -181,6 +181,9 @@ protected void SetExperimentOption(string experimentName, bool enabled)
private
bool
FiltersMatch
(
List
<
CompletionFilter
>
expectedMatchingFilters
,
RoslynCompletion
.
CompletionItem
item
)
{
var
matchingFilters
=
FilterSet
.
GetFilters
(
item
);
// Check that the list has no duplicates.
Assert
.
Equal
(
matchingFilters
.
Count
,
matchingFilters
.
Distinct
().
Count
());
return
expectedMatchingFilters
.
SetEquals
(
matchingFilters
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录