Skip to content

Commit bbed7cb

Browse files
committed
chore: 修改对#特殊输入的匹配细节
1 parent 1ae87c8 commit bbed7cb

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/Util/InputTextMatchHelper.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ public static int CalculateMatchScore(string inputText, string matchText, out in
3838
return currentCompletionScore;
3939
}
4040

41+
if (matchText.StartsWith("#", StringComparison.Ordinal)) //以 # 起始的特殊输入,完全匹配
42+
{
43+
if (inputLength > matchLength - 1)
44+
{
45+
return currentCompletionScore;
46+
}
47+
48+
int i = 1, j = 0;
49+
for (; i < matchText.Length && j < inputText.Length; i++, j++)
50+
{
51+
if (matchText[i] != inputText[j])
52+
{
53+
return currentCompletionScore;
54+
}
55+
}
56+
return i == matchText.Length - 1
57+
? i * 1000 * UpperMatchSocre
58+
: i * 100 * UpperMatchSocre;
59+
}
60+
4161
//下方逻辑是从 CompletionSet 中 copy 后改的
4262

4363
var inputIndex = 0;

src/source.extension.vsixmanifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="ChinesePinyinIntelliSenseExtender.4293B766-9575-4472-B6F0-98BD86737E0D" Version="1.4.2" Language="en-US" Publisher="Stratos" />
4+
<Identity Id="ChinesePinyinIntelliSenseExtender.4293B766-9575-4472-B6F0-98BD86737E0D" Version="1.4.3" Language="en-US" Publisher="Stratos" />
55
<DisplayName>IntelliSense汉语拼音拓展</DisplayName>
66
<Description xml:space="preserve">表意文字补全拓展(内置汉语拼音、五笔,支持自定义字符映射;)</Description>
77
<MoreInfo>https://github.com/stratosblue/chinesepinyinintellisenseextender</MoreInfo>

0 commit comments

Comments
 (0)