2017-12-29 16:29:47 +00:00
|
|
|
#include "clang_complete.h"
|
2017-12-06 03:32:33 +00:00
|
|
|
#include "message_handler.h"
|
2017-12-29 16:29:47 +00:00
|
|
|
#include "queue_manager.h"
|
|
|
|
#include "working_files.h"
|
2017-12-06 03:32:33 +00:00
|
|
|
|
2017-12-06 05:03:38 +00:00
|
|
|
namespace {
|
2018-01-19 08:56:09 +00:00
|
|
|
struct Ipc_TextDocumentDidClose
|
|
|
|
: public NotificationMessage<Ipc_TextDocumentDidClose> {
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDidClose;
|
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;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidClose::Params, textDocument);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidClose, params);
|
|
|
|
REGISTER_IPC_MESSAGE(Ipc_TextDocumentDidClose);
|
|
|
|
|
2017-12-06 03:32:33 +00:00
|
|
|
struct TextDocumentDidCloseHandler
|
|
|
|
: BaseMessageHandler<Ipc_TextDocumentDidClose> {
|
|
|
|
void Run(Ipc_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;
|
2017-12-24 00:25:18 +00:00
|
|
|
QueueManager::WriteStdout(IpcId::TextDocumentPublishDiagnostics, 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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
REGISTER_MESSAGE_HANDLER(TextDocumentDidCloseHandler);
|
2017-12-31 03:18:33 +00:00
|
|
|
} // namespace
|