Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
33cd7fdf
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,发现更多精彩内容 >>
提交
33cd7fdf
编写于
6月 07, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11834 from CyrusNajmabadi/CompletionHelperWork
Remove turkish specialization.
上级
e2adbfec
6725015b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
42 deletion
+18
-42
src/EditorFeatures/Core/Extensibility/Completion/CompletionHelper.cs
...eatures/Core/Extensibility/Completion/CompletionHelper.cs
+18
-33
src/EditorFeatures/VisualBasic/Completion/VisualBasicCompletionHelper.vb
...res/VisualBasic/Completion/VisualBasicCompletionHelper.vb
+0
-9
未找到文件。
src/EditorFeatures/Core/Extensibility/Completion/CompletionHelper.cs
浏览文件 @
33cd7fdf
...
...
@@ -117,8 +117,8 @@ protected static bool IsAllDigits(string filterText)
protected
PatternMatch
?
GetMatch
(
CompletionItem
item
,
string
filterText
,
bool
includeMatchSpans
)
{
var
patternMatcher
=
this
.
GetPatternMatcher
(
GetCultureSpecificQuirks
(
filterText
)
,
CultureInfo
.
CurrentCulture
);
var
match
=
patternMatcher
.
GetFirstMatch
(
GetCultureSpecificQuirks
(
item
.
FilterText
)
,
includeMatchSpans
);
var
patternMatcher
=
this
.
GetPatternMatcher
(
filterText
,
CultureInfo
.
CurrentCulture
);
var
match
=
patternMatcher
.
GetFirstMatch
(
item
.
FilterText
,
includeMatchSpans
);
if
(
match
!=
null
)
{
...
...
@@ -128,8 +128,8 @@ protected static bool IsAllDigits(string filterText)
// Start with the culture-specific comparison, and fall back to en-US.
if
(!
CultureInfo
.
CurrentCulture
.
Equals
(
EnUSCultureInfo
))
{
patternMatcher
=
this
.
Get
FallbackPatternMatcher
(
GetCultureSpecificQuirks
(
filterText
)
);
match
=
patternMatcher
.
GetFirstMatch
(
GetCultureSpecificQuirks
(
item
.
FilterText
)
);
patternMatcher
=
this
.
Get
EnUSPatternMatcher
(
filterText
);
match
=
patternMatcher
.
GetFirstMatch
(
item
.
FilterText
);
if
(
match
!=
null
)
{
return
match
;
...
...
@@ -139,52 +139,37 @@ protected static bool IsAllDigits(string filterText)
return
null
;
}
/// <summary>
/// Apply any culture-specific quirks to the given text for the purposes of pattern matching.
/// For example, in the Turkish locale, capital 'i's should be treated specially in Visual Basic.
/// </summary>
protected
virtual
string
GetCultureSpecificQuirks
(
string
candidate
)
{
return
candidate
;
}
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
>();
internal
static
readonly
CultureInfo
EnUSCultureInfo
=
new
CultureInfo
(
"en-US"
);
protected
PatternMatcher
GetPatternMatcher
(
string
value
,
CultureInfo
culture
)
private
PatternMatcher
GetPatternMatcher
(
string
value
,
CultureInfo
culture
,
Dictionary
<
string
,
PatternMatcher
>
map
)
{
lock
(
_gate
)
{
PatternMatcher
patternMatcher
;
if
(!
_patternMatcherM
ap
.
TryGetValue
(
value
,
out
patternMatcher
))
if
(!
m
ap
.
TryGetValue
(
value
,
out
patternMatcher
))
{
patternMatcher
=
new
PatternMatcher
(
value
,
culture
,
verbatimIdentifierPrefixIsWordCharacter
:
true
,
patternMatcher
=
new
PatternMatcher
(
value
,
culture
,
verbatimIdentifierPrefixIsWordCharacter
:
true
,
allowFuzzyMatching
:
false
);
_patternMatcherM
ap
.
Add
(
value
,
patternMatcher
);
m
ap
.
Add
(
value
,
patternMatcher
);
}
return
patternMatcher
;
}
}
pr
ivate
PatternMatcher
GetFallbackPatternMatcher
(
string
valu
e
)
pr
otected
PatternMatcher
GetPatternMatcher
(
string
value
,
CultureInfo
cultur
e
)
{
lock
(
_gate
)
{
PatternMatcher
patternMatcher
;
if
(!
_fallbackPatternMatcherMap
.
TryGetValue
(
value
,
out
patternMatcher
))
{
patternMatcher
=
new
PatternMatcher
(
value
,
EnUSCultureInfo
,
verbatimIdentifierPrefixIsWordCharacter
:
true
,
allowFuzzyMatching
:
false
);
_fallbackPatternMatcherMap
.
Add
(
value
,
patternMatcher
);
}
return
GetPatternMatcher
(
value
,
culture
,
_patternMatcherMap
);
}
return
patternMatcher
;
}
private
PatternMatcher
GetEnUSPatternMatcher
(
string
value
)
{
return
GetPatternMatcher
(
value
,
EnUSCultureInfo
,
_fallbackPatternMatcherMap
);
}
/// <summary>
...
...
@@ -193,8 +178,8 @@ private PatternMatcher GetFallbackPatternMatcher(string value)
/// </summary>
public
virtual
bool
IsBetterFilterMatch
(
CompletionItem
item1
,
CompletionItem
item2
,
string
filterText
,
CompletionTrigger
trigger
,
CompletionFilterReason
filterReason
,
ImmutableArray
<
string
>
recentItems
=
default
(
ImmutableArray
<
string
>))
{
var
match1
=
GetMatch
(
item1
,
GetCultureSpecificQuirks
(
filterText
)
);
var
match2
=
GetMatch
(
item2
,
GetCultureSpecificQuirks
(
filterText
)
);
var
match1
=
GetMatch
(
item1
,
filterText
);
var
match2
=
GetMatch
(
item2
,
filterText
);
if
(
match1
!=
null
&&
match2
!=
null
)
{
...
...
src/EditorFeatures/VisualBasic/Completion/VisualBasicCompletionHelper.vb
浏览文件 @
33cd7fdf
...
...
@@ -52,15 +52,6 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Completion
Return
MyBase
.
MatchesFilterText
(
item
,
filterText
,
trigger
,
filterReason
,
recentItems
)
End
Function
Protected
Overrides
Function
GetCultureSpecificQuirks
(
candidate
As
String
)
As
String
' TODO: define way to identify this case w/o language specific check
If
CultureInfo
.
CurrentCulture
.
Name
=
"tr-TR"
Then
Return
candidate
.
Replace
(
"I"
c
,
"İ"
c
)
End
If
Return
candidate
End
Function
Public
Overrides
Function
IsBetterFilterMatch
(
item1
As
CompletionItem
,
item2
As
CompletionItem
,
filterText
As
String
,
trigger
As
CompletionTrigger
,
filterReason
As
CompletionFilterReason
,
Optional
recentItems
As
ImmutableArray
(
Of
String
)
=
Nothing
)
As
Boolean
If
filterReason
=
CompletionFilterReason
.
BackspaceOrDelete
Then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录