| 300 | } |
| 301 | |
| 302 | std::shared_ptr<lsp::DocumentDiagnosticReport> LSPHandle::OnTextDocumentDiagnostic( |
| 303 | std::shared_ptr<lsp::DocumentDiagnosticParams> params) { |
| 304 | auto report = std::make_shared<lsp::DocumentDiagnosticReport>(); |
| 305 | report->kind = lsp::DocumentDiagnosticReportKind::Full; |
| 306 | |
| 307 | auto &vfs = _server->GetVFS(); |
| 308 | auto opFileId = vfs.GetUriDB().Query(params->textDocument.uri); |
| 309 | if (!opFileId.has_value()) { |
| 310 | return report; |
| 311 | } |
| 312 | |
| 313 | auto opSyntaxTree = vfs.GetVirtualFile(params->textDocument.uri).GetSyntaxTree(vfs); |
| 314 | if (!opSyntaxTree.has_value()) { |
| 315 | return report; |
| 316 | } |
| 317 | |
| 318 | auto &syntaxTree = opSyntaxTree.value(); |
| 319 | |
| 320 | if (syntaxTree.HasError()) { |
| 321 | return report; |
| 322 | } |
| 323 | |
| 324 | LuaStyle &luaStyle = _server->GetService<ConfigService>()->GetLuaStyle(params->textDocument.uri); |
| 325 | |
| 326 | auto diagnostics = _server->GetService<DiagnosticService>()->Diagnostic( |
| 327 | opFileId.value(), syntaxTree, luaStyle); |
| 328 | report->resultId = std::to_string(opFileId.value()); |
| 329 | |
| 330 | report->items = std::move(diagnostics); |
| 331 | return report; |
| 332 | } |
| 333 | |
| 334 | |
| 335 | std::shared_ptr<lsp::WorkspaceDiagnosticReport> LSPHandle::OnWorkspaceDiagnostic( |
nothing calls this directly
no test coverage detected