Basic implementation of SemanticTokens.

This commit is contained in:
ykiko
2024-11-26 20:18:40 +08:00
parent 633db416e6
commit 8857bc1a3a
15 changed files with 511 additions and 223 deletions

View File

@@ -77,7 +77,7 @@ struct InitializeParams {
struct ServerCapabilities {
std::string_view positionEncoding = "utf-16";
TextDocumentSyncKind textDocumentSync = TextDocumentSyncKind::Full;
// SemanticTokensOptions semanticTokensProvider;
SemanticTokensOptions semanticTokensProvider;
};
struct InitializeResult {
@@ -303,7 +303,7 @@ private:
struct Task {
TaskKind kind;
async::promise<void> request;
llvm::unique_function<async::promise<void>(Compiler&)> request;
};
State state;
@@ -311,16 +311,11 @@ private:
std::vector<Task> tasks;
};
async::promise<void> schedule(llvm::StringRef path, async::promise<void> request) {
auto& unit = units[path];
if(unit.state == TranslationUnit::State::Building) {
// unit.requests.push_back(std::move(request));
} else {
co_await request;
}
co_return;
}
/// Schedule a task for a file. If the file is building, the task will be
/// appended to the task list of the file and wait for the building to finish.
/// Otherwise, the task will be executed immediately.
async::promise<void> schedule(llvm::StringRef path,
llvm::unique_function<async::promise<void>(Compiler&)> callback);
private:
llvm::StringMap<PCH> pchs;