MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / SpellCheck

Method SpellCheck

CodeFormatLib/src/LuaCodeFormat.cpp:199–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::SpellCheck(const std::string &uri, std::string &&text,
200 const CodeSpellChecker::CustomDictionary &tempDict) {
201 auto file = LuaSource::From(std::move(text));
202 LuaLexer luaLexer(file);
203 if (_supportNonStandardSymbol) {
204 luaLexer.SupportNonStandardSymbol();
205 }
206 if (_supportCLikeComments) {
207 luaLexer.SupportCLikeComments();
208 }
209
210 luaLexer.Parse();
211
212 LuaParser p(file, std::move(luaLexer.GetTokens()));
213 p.Parse();
214
215 if (p.HasError()) {
216 return ResultType::Err;
217 }
218
219 LuaSyntaxTree t;
220 t.BuildTree(p);
221
222 LuaStyle style = GetStyle(uri);
223
224 DiagnosticBuilder diagnosticBuilder(style, _diagnosticStyle);
225 _spellChecker.SetCustomDictionary(tempDict);
226 diagnosticBuilder.SpellCheck(t, _spellChecker);
227 return MakeDiagnosticInfo(diagnosticBuilder.GetDiagnosticResults(t), file);
228}
229
230Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::NameStyleCheck(const std::string &uri, std::string &&text) {
231 auto file = LuaSource::From(std::move(text));

Callers 2

spell_analysisFunction · 0.45
DiagnosticMethod · 0.45

Calls 8

GetTokensMethod · 0.80
BuildTreeMethod · 0.80
SetCustomDictionaryMethod · 0.80
GetDiagnosticResultsMethod · 0.80
SupportCLikeCommentsMethod · 0.45
ParseMethod · 0.45
HasErrorMethod · 0.45

Tested by

no test coverage detected