refactor(editor): share the compdb entry query with a new CLI command
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 8s

This commit is contained in:
faumaray committed 2026-12-04 08:09:11 +03:00
1 parent af735c28ff
commit f5eb489e79
9 files changed
+221 -64

No files matched your search

+25
View File
@@ -94,6 +94,31 @@ parse_ide_kind(std::string_view name);
[[nodiscard]] Void::Result::Result<IdeConfigReport, Void::Result::Error>
generate_ide_configs(const Graph::BuildGraph &graph, const IdeConfigOptions &options);
// One projected compile_commands entry (bounded) for editor/tooling queries.
struct CompdbEntry {
std::string file;
std::string directory;
std::string output;
std::string command;
std::vector<std::string> arguments;
};
struct CompdbQuery {
std::string file_filter; // Only entries whose source path ends with this value.
std::size_t limit{50}; // Maximum returned entries (0 allowed).
};
struct CompdbQueryResult {
std::filesystem::path compdb_path;
std::size_t total{0};
std::vector<CompdbEntry> entries;
};
// Reads a JSON compilation database and projects bounded entries. Argument count and length
// are capped so a hostile or huge database cannot exhaust the caller.
[[nodiscard]] Void::Result::Result<CompdbQueryResult, Void::Result::Error>
query_compdb_entries(const std::filesystem::path &compdb_path, const CompdbQuery &query);
// Emits versioned JSON workspace/target metadata for external IDE plugins (`vbs ide query`).
[[nodiscard]] std::string format_ide_query_json(const Graph::BuildGraph &graph,
const std::filesystem::path &compdb_path,