forked from MaskRay/ccls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext_document_did_close.cc
38 lines (32 loc) · 1.21 KB
/
text_document_did_close.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "clang_complete.h"
#include "message_handler.h"
#include "queue_manager.h"
#include "working_files.h"
namespace {
MethodType kMethodType = "textDocument/didClose";
struct In_TextDocumentDidClose : public NotificationInMessage {
MethodType GetMethodType() const override { return kMethodType; }
struct Params {
lsTextDocumentIdentifier textDocument;
};
Params params;
};
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; }
void Run(In_TextDocumentDidClose* request) override {
std::string path = request->params.textDocument.uri.GetPath();
// Clear any diagnostics for the file.
Out_TextDocumentPublishDiagnostics out;
out.params.uri = request->params.textDocument.uri;
QueueManager::WriteStdout(kMethodType, out);
// Remove internal state.
working_files->OnClose(request->params.textDocument);
clang_complete->NotifyClose(path);
}
};
REGISTER_MESSAGE_HANDLER(Handler_TextDocumentDidClose);
} // namespace