Improve AST handling (#165)

This commit is contained in:
ykiko
2025-08-03 17:43:42 +08:00
committed by GitHub
parent 893edc7634
commit 139eaa44f7
47 changed files with 1205 additions and 1094 deletions

View File

@@ -25,7 +25,7 @@ async::Task<OpenFile*> Server::add_document(std::string path, std::string conten
}
async::Task<> Server::build_pch(std::string path, std::string content) {
auto bound = computePreambleBound(content);
auto bound = compute_preamble_bound(content);
auto openFile = &opening_files[path];
bool outdated = true;
@@ -58,7 +58,7 @@ async::Task<> Server::build_pch(std::string path, std::string content) {
diagnostics->clear();
CompilationParams params;
params.outPath = path::join(config::cache.dir, path::filename(path) + ".pch");
params.output_file = path::join(config::cache.dir, path::filename(path) + ".pch");
params.arguments = server.database.get_command(path, true, true).arguments;
params.diagnostics = diagnostics;
params.add_remapped_file(path, content, bound);
@@ -155,6 +155,9 @@ async::Task<> Server::build_ast(std::string path, std::string content) {
if(!ast) {
/// FIXME: Fails needs cancel waiting tasks.
log::warn("Building AST fails for {}, Beacuse: {}", path, ast.error());
for(auto& diagnostic: *file->diagnostics) {
log::warn("{}", diagnostic.message);
}
co_return;
}