mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 17:41:58 +00:00
c68548a2ca
% time clang++ -fsyntax-only -std=c++11 a.cc <iostream> => 0.35s <regex> => 0.68s
21 lines
767 B
C++
21 lines
767 B
C++
#include "lsp_diagnostic.h"
|
|
|
|
#include "queue_manager.h"
|
|
#include "working_files.h"
|
|
|
|
void EmitDiagnostics(WorkingFiles* working_files,
|
|
std::string path,
|
|
std::vector<lsDiagnostic> diagnostics) {
|
|
// Emit diagnostics.
|
|
Out_TextDocumentPublishDiagnostics out;
|
|
out.params.uri = lsDocumentUri::FromPath(path);
|
|
out.params.diagnostics = diagnostics;
|
|
QueueManager::WriteStdout(IpcId::TextDocumentPublishDiagnostics, out);
|
|
|
|
// Cache diagnostics so we can show fixits.
|
|
working_files->DoActionOnFile(path, [&](WorkingFile* working_file) {
|
|
if (working_file)
|
|
working_file->diagnostics_ = diagnostics;
|
|
});
|
|
}
|