Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/clice.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/Server/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 8 additions & 2 deletions src/Server/Lifecycle.cpp
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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.
Expand Down
Loading