2017-05-21 19:51:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "serializer.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
struct Config {
|
|
|
|
// Root directory of the project. **Not serialized**
|
|
|
|
std::string projectRoot;
|
2017-11-17 22:45:49 +00:00
|
|
|
// Location of compile_commands.json.
|
2017-11-21 16:47:28 +00:00
|
|
|
std::string compilationDatabaseDirectory;
|
2017-07-16 00:25:52 +00:00
|
|
|
// Cache directory for indexed files.
|
2017-05-21 19:51:15 +00:00
|
|
|
std::string cacheDirectory;
|
2018-01-06 23:29:53 +00:00
|
|
|
// Cache serialization format
|
|
|
|
SerializeFormat cacheFormat = SerializeFormat::Json;
|
2017-10-25 01:02:15 +00:00
|
|
|
// Value to use for clang -resource-dir if not present in
|
|
|
|
// compile_commands.json.
|
|
|
|
std::string resourceDirectory;
|
2017-05-22 06:45:47 +00:00
|
|
|
|
2017-05-21 19:51:15 +00:00
|
|
|
std::vector<std::string> extraClangArguments;
|
|
|
|
|
2017-05-22 06:45:47 +00:00
|
|
|
std::vector<std::string> indexWhitelist;
|
|
|
|
std::vector<std::string> indexBlacklist;
|
|
|
|
// If true, project paths that were skipped by the whitelist/blacklist will
|
|
|
|
// be logged.
|
|
|
|
bool logSkippedPathsForIndex = false;
|
2017-09-22 01:14:57 +00:00
|
|
|
|
2017-05-21 19:51:15 +00:00
|
|
|
// Maximum workspace search results.
|
2017-12-24 06:49:45 +00:00
|
|
|
int maxWorkspaceSearchResults = 500;
|
2017-05-21 19:51:15 +00:00
|
|
|
|
|
|
|
// Force a certain number of indexer threads. If less than 1 a default value
|
|
|
|
// should be used.
|
|
|
|
int indexerCount = 0;
|
|
|
|
// If false, the indexer will be disabled.
|
|
|
|
bool enableIndexing = true;
|
|
|
|
// If false, indexed files will not be written to disk.
|
|
|
|
bool enableCacheWrite = true;
|
|
|
|
// If false, the index will not be loaded from a previous run.
|
|
|
|
bool enableCacheRead = true;
|
|
|
|
|
2017-11-26 22:20:43 +00:00
|
|
|
// If true, cquery will send progress reports while indexing
|
2018-01-07 21:06:18 +00:00
|
|
|
// How often should cquery send progress report messages?
|
|
|
|
// -1: never
|
|
|
|
// 0: as often as possible
|
|
|
|
// xxx: at most every xxx milliseconds
|
|
|
|
//
|
|
|
|
// Empty progress reports (ie, idle) are delivered as often as they are
|
|
|
|
// available and may exceed this value.
|
|
|
|
//
|
|
|
|
// This does not guarantee a progress report will be delivered every
|
|
|
|
// interval; it could take significantly longer if cquery is completely idle.
|
|
|
|
int progressReportFrequencyMs = 500;
|
2017-11-26 22:20:43 +00:00
|
|
|
|
2017-05-21 19:51:15 +00:00
|
|
|
// If true, document links are reported for #include directives.
|
|
|
|
bool showDocumentLinksOnIncludes = true;
|
|
|
|
|
2017-05-21 21:01:52 +00:00
|
|
|
// Maximum path length to show in completion results. Paths longer than this
|
|
|
|
// will be elided with ".." put at the front. Set to 0 or a negative number
|
|
|
|
// to disable eliding.
|
|
|
|
int includeCompletionMaximumPathLength = 30;
|
2017-05-21 19:51:15 +00:00
|
|
|
// Whitelist that file paths will be tested against. If a file path does not
|
|
|
|
// end in one of these values, it will not be considered for auto-completion.
|
|
|
|
// An example value is { ".h", ".hpp" }
|
|
|
|
//
|
|
|
|
// This is significantly faster than using a regex.
|
|
|
|
std::vector<std::string> includeCompletionWhitelistLiteralEnding;
|
|
|
|
// Regex patterns to match include completion candidates against. They
|
|
|
|
// receive the absolute file path.
|
|
|
|
//
|
|
|
|
// For example, to hide all files in a /CACHE/ folder, use ".*/CACHE/.*"
|
|
|
|
std::vector<std::string> includeCompletionWhitelist;
|
|
|
|
std::vector<std::string> includeCompletionBlacklist;
|
|
|
|
|
2017-07-16 00:25:52 +00:00
|
|
|
// If true, diagnostics from a full document parse will be reported.
|
|
|
|
bool diagnosticsOnParse = true;
|
|
|
|
// If true, diagnostics from code completion will be reported.
|
|
|
|
bool diagnosticsOnCodeCompletion = true;
|
|
|
|
|
2017-05-21 19:51:15 +00:00
|
|
|
// Enables code lens on parameter and function variables.
|
|
|
|
bool codeLensOnLocalVariables = true;
|
|
|
|
|
2017-12-04 08:29:38 +00:00
|
|
|
// Version of the client. If undefined the version check is skipped. Used to
|
|
|
|
// inform users their vscode client is too old and needs to be updated.
|
|
|
|
optional<int> clientVersion;
|
2017-11-19 12:57:16 +00:00
|
|
|
|
2017-11-19 22:11:54 +00:00
|
|
|
// If true parameter declarations are included in code completion when calling
|
|
|
|
// a function or method
|
2017-11-19 12:57:16 +00:00
|
|
|
bool enableSnippetInsertion = true;
|
2017-05-21 19:51:15 +00:00
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Config,
|
2017-11-21 16:47:28 +00:00
|
|
|
compilationDatabaseDirectory,
|
2017-09-22 01:14:57 +00:00
|
|
|
cacheDirectory,
|
2018-01-07 02:56:15 +00:00
|
|
|
cacheFormat,
|
2017-10-25 01:02:15 +00:00
|
|
|
resourceDirectory,
|
2017-05-22 06:45:47 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
extraClangArguments,
|
2017-05-21 19:51:15 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
indexWhitelist,
|
|
|
|
indexBlacklist,
|
|
|
|
logSkippedPathsForIndex,
|
2017-05-22 06:45:47 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
maxWorkspaceSearchResults,
|
|
|
|
indexerCount,
|
|
|
|
enableIndexing,
|
|
|
|
enableCacheWrite,
|
|
|
|
enableCacheRead,
|
2018-01-07 21:06:18 +00:00
|
|
|
progressReportFrequencyMs,
|
2017-05-21 19:51:15 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
includeCompletionMaximumPathLength,
|
|
|
|
includeCompletionWhitelistLiteralEnding,
|
|
|
|
includeCompletionWhitelist,
|
|
|
|
includeCompletionBlacklist,
|
2017-05-21 19:51:15 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
showDocumentLinksOnIncludes,
|
2017-05-21 19:51:15 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
diagnosticsOnParse,
|
|
|
|
diagnosticsOnCodeCompletion,
|
2017-07-16 00:25:52 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
codeLensOnLocalVariables,
|
2017-05-21 19:51:15 +00:00
|
|
|
|
2017-11-19 12:57:16 +00:00
|
|
|
clientVersion,
|
2017-11-21 16:47:28 +00:00
|
|
|
enableSnippetInsertion);
|
2017-12-05 07:57:41 +00:00
|
|
|
|
|
|
|
// Expected client version. We show an error if this doesn't match.
|
2017-12-24 03:23:29 +00:00
|
|
|
constexpr const int kExpectedClientVersion = 3;
|