Skip to content

Commit 02c48cc

Browse files
committed
修复标识分词算法bug
1 parent 3c00e0c commit 02c48cc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CodeService/src/Spell/CodeSpellChecker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ std::vector<SuggestItem> CodeSpellChecker::GetSuggests(std::string word)
146146
return suggests;
147147
}
148148

149-
void CodeSpellChecker::IdentifyAnalysis(DiagnosisContext& ctx, LuaToken& token, const CustomDictionary& cutomDict)
149+
void CodeSpellChecker::IdentifyAnalysis(DiagnosisContext& ctx, LuaToken& token, const CustomDictionary& customDict)
150150
{
151151
std::shared_ptr<spell::IdentifyParser> parser = nullptr;
152152
std::string text(token.Text);
153153

154-
if (cutomDict.count(text) != 0)
154+
if (customDict.count(text) != 0)
155155
{
156156
return;
157157
}
@@ -176,7 +176,7 @@ void CodeSpellChecker::IdentifyAnalysis(DiagnosisContext& ctx, LuaToken& token,
176176

177177
for (auto& word : words)
178178
{
179-
if (!word.Item.empty() && !_symSpell->IsCorrectWord(word.Item) && cutomDict.count(word.Item) == 0)
179+
if (!word.Item.empty() && !_symSpell->IsCorrectWord(word.Item) && customDict.count(word.Item) == 0)
180180
{
181181
auto range = TextRange(token.Range.StartOffset + word.Range.Start,
182182
token.Range.StartOffset + word.Range.Start + word.Range.Count - 1

CodeService/src/Spell/IdentifyParser.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "CodeService/Spell/IdentifyParser.h"
1+
#include "CodeService/Spell/IdentifyParser.h"
22
#include <climits>
33

44
using namespace spell;
@@ -120,6 +120,8 @@ IdentifyParser::IdentifyType IdentifyParser::Lex()
120120
{
121121
break;
122122
}
123+
// 忽略会忽略掉当前扫描到的字符,所以这里退格一位
124+
--_currentIndex;
123125
return IdentifyType::Ignore;
124126
}
125127
case ParseState::LowerCase:

0 commit comments

Comments
 (0)