mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 09:50:26 +00:00
Add config->diagnostics.{blacklist,whitelist}
This commit is contained in:
parent
df55e79e4e
commit
e6c4d32a6b
@ -178,7 +178,7 @@ void RunQueryDbThread(const std::string& bin_name,
|
|||||||
SemanticHighlightSymbolCache semantic_cache;
|
SemanticHighlightSymbolCache semantic_cache;
|
||||||
WorkingFiles working_files;
|
WorkingFiles working_files;
|
||||||
FileConsumerSharedState file_consumer_shared;
|
FileConsumerSharedState file_consumer_shared;
|
||||||
DiagnosticsEngine diag_engine(config);
|
DiagnosticsEngine diag_engine;
|
||||||
|
|
||||||
ClangCompleteManager clang_complete(
|
ClangCompleteManager clang_complete(
|
||||||
config, &project, &working_files,
|
config, &project, &working_files,
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
DiagnosticsEngine::DiagnosticsEngine(Config* config)
|
void DiagnosticsEngine::Init(Config* config) {
|
||||||
: match_(config->diagnostics.whitelist, config->diagnostics.blacklist) {}
|
frequencyMs_ = config->diagnostics.frequencyMs;
|
||||||
|
match_ = MakeUnique<GroupMatch>(config->diagnostics.whitelist, config->diagnostics.blacklist);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DiagnosticsEngine::Publish(WorkingFiles* working_files,
|
void DiagnosticsEngine::Publish(WorkingFiles* working_files,
|
||||||
std::string path,
|
std::string path,
|
||||||
@ -19,7 +22,7 @@ void DiagnosticsEngine::Publish(WorkingFiles* working_files,
|
|||||||
int64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(
|
int64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
||||||
if (frequencyMs_ >= 0 && (nextPublish_ <= now || diagnostics.empty()) &&
|
if (frequencyMs_ >= 0 && (nextPublish_ <= now || diagnostics.empty()) &&
|
||||||
match_.IsMatch(path)) {
|
match_->IsMatch(path)) {
|
||||||
nextPublish_ = now + frequencyMs_;
|
nextPublish_ = now + frequencyMs_;
|
||||||
|
|
||||||
Out_TextDocumentPublishDiagnostics out;
|
Out_TextDocumentPublishDiagnostics out;
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
#include "working_files.h"
|
#include "working_files.h"
|
||||||
|
|
||||||
class DiagnosticsEngine {
|
class DiagnosticsEngine {
|
||||||
int frequencyMs_ = 0;
|
std::unique_ptr<GroupMatch> match_;
|
||||||
GroupMatch match_;
|
|
||||||
int64_t nextPublish_ = 0;
|
int64_t nextPublish_ = 0;
|
||||||
|
int frequencyMs_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DiagnosticsEngine(Config* config);
|
void Init(Config*);
|
||||||
void SetFrequencyMs(int ms) { frequencyMs_ = ms; }
|
|
||||||
void Publish(WorkingFiles* working_files,
|
void Publish(WorkingFiles* working_files,
|
||||||
std::string path,
|
std::string path,
|
||||||
std::vector<lsDiagnostic> diagnostics);
|
std::vector<lsDiagnostic> diagnostics);
|
||||||
|
@ -792,7 +792,7 @@ TEST_SUITE("ImportPipeline") {
|
|||||||
|
|
||||||
QueueManager* queue = nullptr;
|
QueueManager* queue = nullptr;
|
||||||
Config config;
|
Config config;
|
||||||
DiagnosticsEngine diag_engine{&config};
|
DiagnosticsEngine diag_engine;
|
||||||
WorkingFiles working_files;
|
WorkingFiles working_files;
|
||||||
FileConsumerSharedState file_consumer_shared;
|
FileConsumerSharedState file_consumer_shared;
|
||||||
TimestampManager timestamp_manager;
|
TimestampManager timestamp_manager;
|
||||||
|
@ -582,7 +582,7 @@ struct InitializeHandler : BaseMessageHandler<Ipc_InitializeRequest> {
|
|||||||
EscapeFileName(config->projectRoot));
|
EscapeFileName(config->projectRoot));
|
||||||
|
|
||||||
Timer time;
|
Timer time;
|
||||||
diag_engine->SetFrequencyMs(config->diagnostics.frequencyMs);
|
diag_engine->Init(config);
|
||||||
|
|
||||||
// Open up / load the project.
|
// Open up / load the project.
|
||||||
project->Load(config, config->extraClangArguments,
|
project->Load(config, config->extraClangArguments,
|
||||||
|
Loading…
Reference in New Issue
Block a user