| 38 | } |
| 39 | |
| 40 | nlohmann::json DiagnosticToJson(std::string_view message, TextRange range, LuaSource &file) { |
| 41 | auto startLine = file.GetLine(range.StartOffset); |
| 42 | auto startChar = file.GetColumn(range.StartOffset); |
| 43 | auto endLine = file.GetLine(range.GetEndOffset()); |
| 44 | auto endChar = file.GetColumn(range.GetEndOffset()); |
| 45 | auto obj = nlohmann::json::object(); |
| 46 | obj["message"] = message; |
| 47 | obj["range"] = { |
| 48 | {"start", {{"line", startLine}, {"character", startChar}}}, |
| 49 | {"end", {{"line", endLine}, {"character", endChar}} } |
| 50 | }; |
| 51 | return obj; |
| 52 | } |
| 53 | |
| 54 | bool LuaCheck::CheckSingleFile(const FormatContext &context, std::string_view path, std::string &&sourceText, LuaStyle style) { |
| 55 | auto file = std::make_shared<LuaSource>(std::move(sourceText)); |
no test coverage detected