Successfully implemented SemanticTokens communication between the client and server.

This commit is contained in:
ykiko
2024-09-12 22:02:48 +08:00
parent 081e6d1d53
commit 783edfe709
7 changed files with 296 additions and 45 deletions

View File

@@ -19,6 +19,18 @@ struct ParsedAST {
llvm::StringRef content,
std::vector<const char*>& args,
Preamble* preamble = nullptr);
clang::FileID getFileID(llvm::StringRef filename) const {
auto entry = fileManager.getFileRef(filename);
if(!entry) {
// TODO:
}
return sourceManager.translateFile(entry.get());
}
llvm::ArrayRef<clang::syntax::Token> spelledTokens(clang::FileID fileID) const {
return tokenBuffer.spelledTokens(fileID);
}
};
} // namespace clice

View File

@@ -1,3 +1,5 @@
#pragma once
#include <llvm/ADT/StringMap.h>
#include <Support/JSON.h>
#include <AST/Preamble.h>
@@ -17,7 +19,7 @@ private:
};
public:
void dispatch(std::string_view method, json::Value value);
void dispatch(json::Value id, std::string_view method, json::Value value);
private:
llvm::StringMap<TU> files;