ccls/src/messages/workspace_execute_command.cc

51 lines
1.6 KiB
C++
Raw Normal View History

2018-03-02 04:33:21 +00:00
#include "lsp_code_action.h"
#include "message_handler.h"
#include "query_utils.h"
#include "queue_manager.h"
namespace {
MethodType kMethodType = "workspace/executeCommand";
2018-03-02 04:33:21 +00:00
2018-03-22 05:01:21 +00:00
struct In_WorkspaceExecuteCommand : public RequestInMessage {
MethodType GetMethodType() const override { return kMethodType; }
2018-03-02 04:33:21 +00:00
lsCommand<lsCodeLensCommandArguments> params;
};
MAKE_REFLECT_STRUCT(In_WorkspaceExecuteCommand, id, params);
REGISTER_IN_MESSAGE(In_WorkspaceExecuteCommand);
2018-03-02 04:33:21 +00:00
struct Out_WorkspaceExecuteCommand
: public lsOutMessage<Out_WorkspaceExecuteCommand> {
lsRequestId id;
std::variant<std::vector<lsLocation>, CommandArgs> result;
};
MAKE_REFLECT_STRUCT(Out_WorkspaceExecuteCommand, jsonrpc, id, result);
void Reflect(Writer& visitor, Out_WorkspaceExecuteCommand& value) {
REFLECT_MEMBER_START();
REFLECT_MEMBER(jsonrpc);
REFLECT_MEMBER(id);
REFLECT_MEMBER(result);
REFLECT_MEMBER_END();
}
struct Handler_WorkspaceExecuteCommand
: BaseMessageHandler<In_WorkspaceExecuteCommand> {
MethodType GetMethodType() const override { return kMethodType; }
void Run(In_WorkspaceExecuteCommand* request) override {
2018-03-02 04:33:21 +00:00
const auto& params = request->params;
Out_WorkspaceExecuteCommand out;
out.id = request->id;
2018-03-31 03:16:33 +00:00
if (params.command == "ccls._applyFixIt") {
} else if (params.command == "ccls._autoImplement") {
} else if (params.command == "ccls._insertInclude") {
} else if (params.command == "ccls.showReferences") {
2018-03-02 04:33:21 +00:00
out.result = params.arguments.locations;
}
QueueManager::WriteStdout(kMethodType, out);
2018-03-02 04:33:21 +00:00
}
};
REGISTER_MESSAGE_HANDLER(Handler_WorkspaceExecuteCommand);
2018-03-02 04:33:21 +00:00
} // namespace