diff --git a/docs/option.toml b/docs/option.toml new file mode 100644 index 00000000..3349f873 --- /dev/null +++ b/docs/option.toml @@ -0,0 +1,12 @@ +[clang] +# the path of builtin headers that clang uses +resource-dir = "${executable}/../lib/clang/${version}" +# the commands that will be appended to the command line +append = [] +# the commands that will be removed from the command line +remove = [] + +[completion] + + +[inlay-hint] diff --git a/include/Server/Option.h b/include/Server/Option.h new file mode 100644 index 00000000..85f795de --- /dev/null +++ b/include/Server/Option.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +namespace clice { + +struct Option { + std::string resource_dir; + static Option parse(std::string_view execpath, std::string_view filepath); +}; + +extern Option option; + +} // namespace clice diff --git a/src/Server/Option.cpp b/src/Server/Option.cpp new file mode 100644 index 00000000..ee545aa8 --- /dev/null +++ b/src/Server/Option.cpp @@ -0,0 +1,16 @@ +#include "toml++/toml.hpp" +#include "Server/Option.h" + +namespace clice { + +// TODO: replace builtin variable in Setting +// e.g `{execute}` -> `execpath` + +Option Option::parse(std::string_view execpath, std::string_view filepath) { + auto config = toml::parse_file(filepath); + auto clang = config["clang"]; + auto resource_dir = clang["resource_dir"].as_string()->get(); + return Option{resource_dir}; +} + +} // namespace clice