Update Server.

This commit is contained in:
ykiko
2024-09-11 17:40:32 +08:00
parent f4461ee53a
commit 90dfc40665
10 changed files with 102 additions and 90 deletions

View File

@@ -5,10 +5,20 @@
namespace clice {
struct Option {
std::string compile_commands_directory;
std::string resource_dictionary;
/// predefined variables.
struct {
int argc;
const char** argv;
/// clice binary dictionary.
std::string binary;
/// workplace dictionary.
std::string workplace;
};
void parse(int argc, const char** argv);
std::string resource_dictionary;
std::string compile_commands_directory;
void parse(std::string_view workplace);
};
} // namespace clice

View File

@@ -17,9 +17,7 @@ private:
};
public:
void update(std::string_view path, std::string_view content);
void dispatch(json::Value&& params);
void dispatch(llvm::StringRef method, llvm::Value value);
private:
llvm::StringMap<TU> files;

View File

@@ -2,16 +2,13 @@
#include <Server/Option.h>
#include <Server/Command.h>
#include <Server/Scheduler .h>
#include <Server/Scheduler.h>
#include <Protocol/Protocol.h>
namespace clice {
struct Server {
int argc;
const char** argv;
using Handler = llvm::unique_function<void(json::Value&, json::Value&)>;
using Handler = llvm::unique_function<void(json::Value, json::Value)>;
Option option;
Scheduler scheduler;
@@ -26,6 +23,10 @@ struct Server {
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.