Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
459e4aad
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,发现更多精彩内容 >>
提交
459e4aad
编写于
6月 19, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Single instance the completion helpers so we can cache data across completion calls.
上级
51bca88e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
30 deletion
+20
-30
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.Session_FilterModel.cs
...IntelliSense/Completion/Controller.Session_FilterModel.cs
+12
-2
src/Features/Core/Portable/Completion/CompletionHelper.cs
src/Features/Core/Portable/Completion/CompletionHelper.cs
+8
-16
src/Features/Core/Portable/Completion/CompletionHelperFactory.cs
...tures/Core/Portable/Completion/CompletionHelperFactory.cs
+0
-11
src/Features/Core/Portable/Features.csproj
src/Features/Core/Portable/Features.csproj
+0
-1
未找到文件。
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.Session_FilterModel.cs
浏览文件 @
459e4aad
...
...
@@ -208,6 +208,16 @@ internal partial class Session
return
HandleDeletionTrigger
(
model
,
filterResults
);
}
return
HandleNormalFiltering
(
model
,
filterReason
,
textSnapshot
,
document
,
helper
,
recentItems
,
itemToFilterText
,
filterResults
);
}
private
Model
HandleNormalFiltering
(
Model
model
,
CompletionFilterReason
filterReason
,
ITextSnapshot
textSnapshot
,
Document
document
,
CompletionHelper
helper
,
ImmutableArray
<
string
>
recentItems
,
Dictionary
<
CompletionItem
,
string
>
itemToFilterText
,
List
<
FilterResult
>
filterResults
)
{
// Not deletion. Defer to the language to decide which item it thinks best
// matches the text typed so far.
...
...
@@ -238,8 +248,8 @@ internal partial class Session
// like "WriteLine" since no filter text has actually been provided. HOwever,
// if "Console.WriteL$$" is typed, then we do want "WriteLine" to be committed.
var
matchingItemCount
=
filterResults
.
Where
(
t
=>
t
.
MatchedFilterText
).
Count
();
var
isUnique
=
bestCompletionItem
!=
null
&&
matchingItemCount
==
1
&&
var
isUnique
=
bestCompletionItem
!=
null
&&
matchingItemCount
==
1
&&
itemToFilterText
[
bestCompletionItem
].
Length
>
0
;
var
result
=
model
.
WithFilteredItems
(
filterResults
.
Select
(
r
=>
r
.
PresentationItem
).
AsImmutable
())
...
...
src/Features/Core/Portable/Completion/CompletionHelper.cs
浏览文件 @
459e4aad
...
...
@@ -10,35 +10,33 @@
namespace
Microsoft.CodeAnalysis.Completion
{
internal
class
CompletionHelper
internal
sealed
class
CompletionHelper
{
private
static
readonly
CompletionHelper
CaseSensitiveInstance
=
new
CompletionHelper
(
isCaseSensitive
:
true
);
private
static
readonly
CompletionHelper
CaseInsensitiveInstance
=
new
CompletionHelper
(
isCaseSensitive
:
false
);
private
readonly
object
_gate
=
new
object
();
private
readonly
Dictionary
<
string
,
PatternMatcher
>
_patternMatcherMap
=
new
Dictionary
<
string
,
PatternMatcher
>();
private
readonly
Dictionary
<
string
,
PatternMatcher
>
_fallbackPatternMatcherMap
=
new
Dictionary
<
string
,
PatternMatcher
>();
private
static
readonly
CultureInfo
EnUSCultureInfo
=
new
CultureInfo
(
"en-US"
);
private
readonly
bool
_isCaseSensitive
;
pr
otected
CompletionHelper
(
bool
isCaseSensitive
)
pr
ivate
CompletionHelper
(
bool
isCaseSensitive
)
{
_isCaseSensitive
=
isCaseSensitive
;
}
public
static
CompletionHelper
GetHelper
(
Workspace
workspace
,
string
language
)
{
var
isCaseSensitive
=
true
;
var
ls
=
workspace
.
Services
.
GetLanguageServices
(
language
);
if
(
ls
!=
null
)
{
var
factory
=
ls
.
GetService
<
CompletionHelperFactory
>();
if
(
factory
!=
null
)
{
return
factory
.
CreateCompletionHelper
();
}
var
syntaxFacts
=
ls
.
GetService
<
ISyntaxFactsService
>();
return
new
CompletionHelper
(
syntaxFacts
?.
IsCaseSensitive
??
true
)
;
isCaseSensitive
=
syntaxFacts
?.
IsCaseSensitive
??
true
;
}
return
null
;
return
isCaseSensitive
?
CaseSensitiveInstance
:
CaseInsensitiveInstance
;
}
public
static
CompletionHelper
GetHelper
(
Document
document
)
...
...
@@ -62,12 +60,6 @@ public bool MatchesFilterText(CompletionItem item, string filterText)
return
GetMatch
(
item
,
filterText
)
!=
null
;
}
private
static
int
GetRecentItemIndex
(
ImmutableArray
<
string
>
recentItems
,
CompletionItem
item
)
{
var
index
=
recentItems
.
IndexOf
(
item
.
DisplayText
);
return
-
index
;
}
private
PatternMatch
?
GetMatch
(
CompletionItem
item
,
string
filterText
)
{
return
GetMatch
(
item
,
filterText
,
includeMatchSpans
:
false
);
...
...
src/Features/Core/Portable/Completion/CompletionHelperFactory.cs
已删除
100644 → 0
浏览文件 @
51bca88e
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
Microsoft.CodeAnalysis.Host
;
namespace
Microsoft.CodeAnalysis.Completion
{
internal
abstract
class
CompletionHelperFactory
:
ILanguageService
{
public
abstract
CompletionHelper
CreateCompletionHelper
();
}
}
\ No newline at end of file
src/Features/Core/Portable/Features.csproj
浏览文件 @
459e4aad
...
...
@@ -168,7 +168,6 @@
<Compile
Include=
"Completion\CompletionDescription.cs"
/>
<Compile
Include=
"Completion\CompletionFilterReason.cs"
/>
<Compile
Include=
"Completion\CompletionHelper.cs"
/>
<Compile
Include=
"Completion\CompletionHelperFactory.cs"
/>
<Compile
Include=
"Completion\CompletionItem.cs"
/>
<Compile
Include=
"Completion\CompletionItemFilter.cs"
/>
<Compile
Include=
"Completion\CompletionItemRules.cs"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录