2017-12-29 16:29:47 +00:00
|
|
|
#include "clang_complete.h"
|
2017-12-06 03:32:33 +00:00
|
|
|
#include "message_handler.h"
|
2018-05-28 00:50:02 +00:00
|
|
|
#include "pipeline.hh"
|
2017-12-29 16:29:47 +00:00
|
|
|
#include "working_files.h"
|
2018-05-28 00:50:02 +00:00
|
|
|
using namespace ccls;
|
2017-12-06 03:32:33 +00:00
|
|
|
|
2017-12-06 05:03:38 +00:00
|
|
|
namespace {
|
2018-03-22 04:05:25 +00:00
|
|
|
MethodType kMethodType = "textDocument/didClose";
|
|
|
|
|
2018-03-22 05:01:21 +00:00
|
|
|
struct In_TextDocumentDidClose : public NotificationInMessage {
|
2018-03-22 04:05:25 +00:00
|
|
|
MethodType GetMethodType() const override { return kMethodType; }
|
2017-12-06 04:39:44 +00:00
|
|
|
struct Params {
|
2018-01-13 02:59:25 +00:00
|
|
|
lsTextDocumentIdentifier textDocument;
|
2017-12-06 04:39:44 +00:00
|
|
|
};
|
|
|
|
Params params;
|
|
|
|
};
|
2018-03-22 04:05:25 +00:00
|
|
|
MAKE_REFLECT_STRUCT(In_TextDocumentDidClose::Params, textDocument);
|
|
|
|
MAKE_REFLECT_STRUCT(In_TextDocumentDidClose, params);
|
|
|
|
REGISTER_IN_MESSAGE(In_TextDocumentDidClose);
|
|
|
|
|
|
|
|
struct Handler_TextDocumentDidClose
|
|
|
|
: BaseMessageHandler<In_TextDocumentDidClose> {
|
|
|
|
MethodType GetMethodType() const override { return kMethodType; }
|
2017-12-06 04:39:44 +00:00
|
|
|
|
2018-03-22 04:05:25 +00:00
|
|
|
void Run(In_TextDocumentDidClose* request) override {
|
2017-12-06 03:32:33 +00:00
|
|
|
std::string path = request->params.textDocument.uri.GetPath();
|
|
|
|
|
|
|
|
// Clear any diagnostics for the file.
|
|
|
|
Out_TextDocumentPublishDiagnostics out;
|
|
|
|
out.params.uri = request->params.textDocument.uri;
|
2018-05-28 00:50:02 +00:00
|
|
|
pipeline::WriteStdout(kMethodType, out);
|
2017-12-06 03:32:33 +00:00
|
|
|
|
|
|
|
// Remove internal state.
|
2017-12-06 04:39:44 +00:00
|
|
|
working_files->OnClose(request->params.textDocument);
|
2017-12-06 03:32:33 +00:00
|
|
|
clang_complete->NotifyClose(path);
|
|
|
|
}
|
|
|
|
};
|
2018-03-22 04:05:25 +00:00
|
|
|
REGISTER_MESSAGE_HANDLER(Handler_TextDocumentDidClose);
|
2017-12-31 03:18:33 +00:00
|
|
|
} // namespace
|