mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-21 16:09:40 +00:00
Add Config->dumpAST for dumping AST after parsing
Example initializationOptions: {"dumpAST": ["a.cc"]}
This commit is contained in:
parent
a3a89af14f
commit
7b8f8e9cad
10
src/config.h
10
src/config.h
@ -90,6 +90,11 @@ struct Config {
|
||||
// If true parameter declarations are included in code completion when calling
|
||||
// a function or method
|
||||
bool enableSnippetInsertion = true;
|
||||
|
||||
//// For debugging
|
||||
|
||||
// Dump AST after parsing if some pattern matches the source filename.
|
||||
std::vector<std::string> dumpAST;
|
||||
};
|
||||
MAKE_REFLECT_STRUCT(Config,
|
||||
compilationDatabaseDirectory,
|
||||
@ -125,7 +130,10 @@ MAKE_REFLECT_STRUCT(Config,
|
||||
codeLensOnLocalVariables,
|
||||
|
||||
clientVersion,
|
||||
enableSnippetInsertion);
|
||||
enableSnippetInsertion,
|
||||
|
||||
dumpAST
|
||||
);
|
||||
|
||||
// Expected client version. We show an error if this doesn't match.
|
||||
constexpr const int kExpectedClientVersion = 3;
|
||||
|
@ -13,8 +13,14 @@ struct ClangIndexer : IIndexer {
|
||||
const std::vector<std::string>& args,
|
||||
const std::vector<FileContents>& file_contents,
|
||||
PerformanceImportFile* perf) override {
|
||||
bool dump_ast = false;
|
||||
for (const std::string& pattern : config->dumpAST)
|
||||
if (file.find(pattern) != std::string::npos) {
|
||||
dump_ast = true;
|
||||
break;
|
||||
}
|
||||
return Parse(config, file_consumer_shared, file, args, file_contents, perf,
|
||||
&index);
|
||||
&index, dump_ast);
|
||||
}
|
||||
|
||||
// Note: constructing this acquires a global lock
|
||||
|
Loading…
Reference in New Issue
Block a user