| 197 | } |
| 198 | |
| 199 | Result<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 | |
| 230 | Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::NameStyleCheck(const std::string &uri, std::string &&text) { |
| 231 | auto file = LuaSource::From(std::move(text)); |
no test coverage detected