| 168 | } |
| 169 | |
| 170 | Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::Diagnostic(const std::string &uri, std::string &&text) { |
| 171 | auto file = std::make_shared<LuaSource>(std::move(text)); |
| 172 | LuaLexer luaLexer(file); |
| 173 | if (_supportNonStandardSymbol) { |
| 174 | luaLexer.SupportNonStandardSymbol(); |
| 175 | } |
| 176 | if (_supportCLikeComments) { |
| 177 | luaLexer.SupportCLikeComments(); |
| 178 | } |
| 179 | |
| 180 | luaLexer.Parse(); |
| 181 | |
| 182 | LuaParser p(file, std::move(luaLexer.GetTokens())); |
| 183 | p.Parse(); |
| 184 | |
| 185 | if (p.HasError()) { |
| 186 | return ResultType::Err; |
| 187 | } |
| 188 | |
| 189 | LuaSyntaxTree t; |
| 190 | t.BuildTree(p); |
| 191 | |
| 192 | LuaStyle style = GetStyle(uri); |
| 193 | |
| 194 | DiagnosticBuilder diagnosticBuilder(style, _diagnosticStyle); |
| 195 | diagnosticBuilder.CodeStyleCheck(t); |
| 196 | return MakeDiagnosticInfo(diagnosticBuilder.GetDiagnosticResults(t), file); |
| 197 | } |
| 198 | |
| 199 | Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::SpellCheck(const std::string &uri, std::string &&text, |
| 200 | const CodeSpellChecker::CustomDictionary &tempDict) { |
no test coverage detected