[clang-tools-extra] 8a2d294 - [clangd] Handle `initialized` notification (no-op to suppress log message)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 03:12:44 PST 2020


Author: Sam McCall
Date: 2020-03-03T12:12:30+01:00
New Revision: 8a2d294ed0e1603c8e4d8198e46f436d2612884e

URL: https://github.com/llvm/llvm-project/commit/8a2d294ed0e1603c8e4d8198e46f436d2612884e
DIFF: https://github.com/llvm/llvm-project/commit/8a2d294ed0e1603c8e4d8198e46f436d2612884e.diff

LOG: [clangd] Handle `initialized` notification (no-op to suppress log message)

Added: 
    

Modified: 
    clang-tools-extra/clangd/ClangdLSPServer.cpp
    clang-tools-extra/clangd/ClangdLSPServer.h
    clang-tools-extra/clangd/Protocol.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 55e63c71b23e..18682866d800 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -600,6 +600,8 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
   Reply(std::move(Result));
 }
 
+void ClangdLSPServer::onInitialized(const InitializedParams &Params) {}
+
 void ClangdLSPServer::onShutdown(const ShutdownParams &Params,
                                  Callback<std::nullptr_t> Reply) {
   // Do essentially nothing, just say we're ready to exit.
@@ -1243,6 +1245,7 @@ ClangdLSPServer::ClangdLSPServer(
       NegotiatedOffsetEncoding(ForcedOffsetEncoding) {
   // clang-format off
   MsgHandler->bind("initialize", &ClangdLSPServer::onInitialize);
+  MsgHandler->bind("initialized", &ClangdLSPServer::onInitialized);
   MsgHandler->bind("shutdown", &ClangdLSPServer::onShutdown);
   MsgHandler->bind("sync", &ClangdLSPServer::onSync);
   MsgHandler->bind("textDocument/rangeFormatting", &ClangdLSPServer::onDocumentRangeFormatting);

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h
index f30fbf6b5149..09167ca39a0f 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -67,6 +67,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
   // LSP methods. Notifications have signature void(const Params&).
   // Calls have signature void(const Params&, Callback<Response>).
   void onInitialize(const InitializeParams &, Callback<llvm::json::Value>);
+  void onInitialized(const InitializedParams &);
   void onShutdown(const ShutdownParams &, Callback<std::nullptr_t>);
   void onSync(const NoParams &, Callback<std::nullptr_t>);
   void onDocumentDidOpen(const DidOpenTextDocumentParams &);

diff  --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index a376e5f39e79..b706e07e5686 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -239,6 +239,7 @@ bool fromJSON(const llvm::json::Value &E, TraceLevel &Out);
 
 struct NoParams {};
 inline bool fromJSON(const llvm::json::Value &, NoParams &) { return true; }
+using InitializedParams = NoParams;
 using ShutdownParams = NoParams;
 using ExitParams = NoParams;
 


        


More information about the cfe-commits mailing list