mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 09:31:59 +00:00
Add clang.excludeArgs and rename diagnostics.onType to onChange
This commit is contained in:
parent
d864f969ad
commit
8a2438411e
@ -600,7 +600,7 @@ void DiagnosticQueryMain(ClangCompleteManager *manager) {
|
|||||||
// Fetching the completion request blocks until we have a request.
|
// Fetching the completion request blocks until we have a request.
|
||||||
ClangCompleteManager::DiagnosticRequest request =
|
ClangCompleteManager::DiagnosticRequest request =
|
||||||
manager->diagnostic_request_.Dequeue();
|
manager->diagnostic_request_.Dequeue();
|
||||||
if (!g_config->diagnostics.onType)
|
if (!g_config->diagnostics.onChange)
|
||||||
continue;
|
continue;
|
||||||
std::string path = request.document.uri.GetPath();
|
std::string path = request.document.uri.GetPath();
|
||||||
|
|
||||||
|
17
src/config.h
17
src/config.h
@ -47,6 +47,9 @@ struct Config {
|
|||||||
SerializeFormat cacheFormat = SerializeFormat::Binary;
|
SerializeFormat cacheFormat = SerializeFormat::Binary;
|
||||||
|
|
||||||
struct Clang {
|
struct Clang {
|
||||||
|
// Arguments that should be excluded, e.g. ["-fopenmp", "-Wall"]
|
||||||
|
std::vector<std::string> excludeArgs;
|
||||||
|
|
||||||
// Additional arguments to pass to clang.
|
// Additional arguments to pass to clang.
|
||||||
std::vector<std::string> extraArgs;
|
std::vector<std::string> extraArgs;
|
||||||
|
|
||||||
@ -137,11 +140,11 @@ struct Config {
|
|||||||
// xxx: at most every xxx milliseconds
|
// xxx: at most every xxx milliseconds
|
||||||
int frequencyMs = 0;
|
int frequencyMs = 0;
|
||||||
|
|
||||||
// If true, diagnostics will be reported in textDocument/didOpen.
|
// If true, diagnostics will be reported for textDocument/didChange.
|
||||||
bool onOpen = true;
|
bool onChange = true;
|
||||||
|
|
||||||
// If true, diagnostics from typing will be reported.
|
// If true, diagnostics will be reported for textDocument/didOpen.
|
||||||
bool onType = true;
|
bool onOpen = true;
|
||||||
|
|
||||||
std::vector<std::string> whitelist;
|
std::vector<std::string> whitelist;
|
||||||
} diagnostics;
|
} diagnostics;
|
||||||
@ -219,15 +222,15 @@ struct Config {
|
|||||||
int maxNum = 2000;
|
int maxNum = 2000;
|
||||||
} xref;
|
} xref;
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(Config::Clang, extraArgs, resourceDir);
|
MAKE_REFLECT_STRUCT(Config::Clang, excludeArgs, extraArgs, resourceDir);
|
||||||
MAKE_REFLECT_STRUCT(Config::ClientCapability, snippetSupport);
|
MAKE_REFLECT_STRUCT(Config::ClientCapability, snippetSupport);
|
||||||
MAKE_REFLECT_STRUCT(Config::CodeLens, localVariables);
|
MAKE_REFLECT_STRUCT(Config::CodeLens, localVariables);
|
||||||
MAKE_REFLECT_STRUCT(Config::Completion, caseSensitivity, dropOldRequests,
|
MAKE_REFLECT_STRUCT(Config::Completion, caseSensitivity, dropOldRequests,
|
||||||
detailedLabel, filterAndSort, includeBlacklist,
|
detailedLabel, filterAndSort, includeBlacklist,
|
||||||
includeMaxPathSize, includeSuffixWhitelist,
|
includeMaxPathSize, includeSuffixWhitelist,
|
||||||
includeWhitelist);
|
includeWhitelist);
|
||||||
MAKE_REFLECT_STRUCT(Config::Diagnostics, blacklist, frequencyMs, onOpen,
|
MAKE_REFLECT_STRUCT(Config::Diagnostics, blacklist, frequencyMs, onChange,
|
||||||
onType, whitelist)
|
onOpen, whitelist)
|
||||||
MAKE_REFLECT_STRUCT(Config::Highlight, lsRanges, blacklist, whitelist)
|
MAKE_REFLECT_STRUCT(Config::Highlight, lsRanges, blacklist, whitelist)
|
||||||
MAKE_REFLECT_STRUCT(Config::Index, blacklist, comments, enabled, multiVersion,
|
MAKE_REFLECT_STRUCT(Config::Index, blacklist, comments, enabled, multiVersion,
|
||||||
multiVersionBlacklist, multiVersionWhitelist, onDidChange,
|
multiVersionBlacklist, multiVersionWhitelist, onDidChange,
|
||||||
|
@ -20,6 +20,7 @@ using namespace ccls;
|
|||||||
#include <clang/Frontend/CompilerInstance.h>
|
#include <clang/Frontend/CompilerInstance.h>
|
||||||
#include <clang/Tooling/CompilationDatabase.h>
|
#include <clang/Tooling/CompilationDatabase.h>
|
||||||
#include <llvm/ADT/ArrayRef.h>
|
#include <llvm/ADT/ArrayRef.h>
|
||||||
|
#include <llvm/ADT/STLExtras.h>
|
||||||
#include <llvm/ADT/StringSet.h>
|
#include <llvm/ADT/StringSet.h>
|
||||||
#include <llvm/Support/LineIterator.h>
|
#include <llvm/Support/LineIterator.h>
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
@ -84,7 +85,7 @@ struct ProjectProcessor {
|
|||||||
args.push_back(arg.substr(5));
|
args.push_back(arg.substr(5));
|
||||||
} else if (arg == "%clang") {
|
} else if (arg == "%clang") {
|
||||||
args.push_back(lang == LanguageId::Cpp ? "clang++" : "clang");
|
args.push_back(lang == LanguageId::Cpp ? "clang++" : "clang");
|
||||||
} else {
|
} else if (!llvm::is_contained(g_config->clang.excludeArgs, arg)) {
|
||||||
args.push_back(arg);
|
args.push_back(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user