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,8 +1,6 @@
#pragma once
#include <Server/Scheduler.h>
#include <llvm/ADT/FunctionExtras.h>
#include <Feature/CodeCompletion.h>
#include "Basic/Basic.h"
namespace clice::proto {
@@ -72,29 +70,6 @@ struct InitializedParams {};
namespace clice {
struct Server {
using Handler = llvm::unique_function<void(json::Value, json::Value)>;
Scheduler scheduler;
llvm::StringMap<Handler> handlers;
int run(int argc, const char** argv);
static Server instance;
Server();
int run(int argc, const char** argv);
void handleMessage(std::string_view message);
void notify();
void response(json::Value id, json::Value result);
public:
// LSP methods, if the return type is void, the method is used for notification.
// otherwise, the method is used for request.
auto initialize(proto::InitializeParams params) -> proto::InitializeResult;
void initialized(proto::InitializedParams params);
};
} // namespace clice
}