feat: replace compile_commands_dirs with compile_commands_paths (#343)
This commit is contained in:
@@ -21,8 +21,8 @@ cache_dir = "${workspace}/.clice/cache"
|
||||
# Directory for storing index files.
|
||||
index_dir = "${workspace}/.clice/index"
|
||||
logging_dir = "${workspace}/.clice/logging"
|
||||
# Compile commands directories to search for compile_commands.json files.
|
||||
compile_commands_dirs = ["${workspace}/build"]
|
||||
# Compile commands files or directories to search for compile_commands.json files.
|
||||
compile_commands_paths = ["${workspace}/build"]
|
||||
|
||||
# Control the behavior for specific files. Note that Clice matches rules
|
||||
# in order. If you want to add your own rules, either delete this rule
|
||||
|
||||
@@ -21,7 +21,7 @@ struct ProjectOptions {
|
||||
|
||||
std::string logging_dir = "${workspace}/.clice/logging";
|
||||
|
||||
std::vector<std::string> compile_commands_dirs = {"${workspace}/build"};
|
||||
std::vector<std::string> compile_commands_paths = {"${workspace}/build"};
|
||||
};
|
||||
|
||||
struct Rule {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "Server/Server.h"
|
||||
|
||||
#include <llvm/Support/FileSystem.h>
|
||||
|
||||
namespace clice {
|
||||
|
||||
async::Task<json::Value> Server::on_initialize(proto::InitializeParams params) {
|
||||
@@ -36,8 +38,12 @@ async::Task<json::Value> Server::on_initialize(proto::InitializeParams params) {
|
||||
opening_files.set_capability(config.project.max_active_file);
|
||||
|
||||
/// Load compile commands.json
|
||||
for(auto& dir: config.project.compile_commands_dirs) {
|
||||
database.load_compile_database(path::join(dir, "compile_commands.json"));
|
||||
for(auto& dir_or_file: config.project.compile_commands_paths) {
|
||||
if(fs::is_directory(dir_or_file)) {
|
||||
database.load_compile_database(path::join(dir_or_file, "compile_commands.json"));
|
||||
} else {
|
||||
database.load_compile_database(dir_or_file);
|
||||
}
|
||||
}
|
||||
|
||||
/// Load cache info.
|
||||
|
||||
Reference in New Issue
Block a user