Some update for server.

This commit is contained in:
ykiko
2024-11-19 17:10:47 +08:00
parent b5139b3e13
commit cd1dfca2f5
13 changed files with 398 additions and 596 deletions

View File

@@ -1,33 +0,0 @@
#include <Server/Scheduler.h>
#include <spdlog/spdlog.h>
#include <Feature/SemanticTokens.h>
#include <Server/Server.h>
namespace clice {
void Scheduler::dispatch(json::Value id, std::string_view method, json::Value value) {
std::vector<const char*> compileArgs = {
"clang++",
"-std=c++20",
"main.cpp",
"-resource-dir=/home/ykiko/C++/clice2/build/lib/clang/20",
};
if(method == "textDocument/didOpen") {
// auto params = json::deserialize<proto::DidOpenTextDocumentParams>(value);
// auto AST = ParsedAST::build("main.cpp", params.textDocument.text, compileArgs);
// files[params.textDocument.uri].ast = std::move(AST);
} else if(method == "textDocument/didChange") {
// auto params = json::deserialize<proto::DidChangeTextDocumentParams>(value);
// auto AST = ParsedAST::build("main.cpp", params.contentChanges.back().text, compileArgs);
// files[params.textDocument.uri].ast = std::move(AST);
} else if(method == "textDocument/semanticTokens/full") {
// auto params = json::deserialize<proto::SemanticTokensParams>(value);
// auto AST = files[params.textDocument.uri].ast.get();
// auto semanticTokens = feature::semanticTokens(*AST, "main.cpp");
// Server::instance.response(std::move(id), json::serialize(semanticTokens));
} else {
spdlog::error("unknown method: {}", method);
}
}
} // namespace clice