[Mlir-commits] [mlir] [mlir-lsp] Support outgoing requests (PR #90078)

Brian Gesiak llvmlistbot at llvm.org
Thu Apr 25 19:23:23 PDT 2024


================
@@ -117,21 +117,17 @@ bool MessageHandler::onCall(llvm::StringRef method, llvm::json::Value params,
 
 bool MessageHandler::onReply(llvm::json::Value id,
                              llvm::Expected<llvm::json::Value> result) {
-  // TODO: Add support for reply callbacks when support for outgoing messages is
-  // added. For now, we just log an error on any replies received.
-  Callback<llvm::json::Value> replyHandler =
-      [&id](llvm::Expected<llvm::json::Value> result) {
-        Logger::error(
-            "received a reply with ID {0}, but there was no such call", id);
-        if (!result)
-          llvm::consumeError(result.takeError());
-      };
-
-  // Log and run the reply handler.
-  if (result)
-    replyHandler(std::move(result));
-  else
-    replyHandler(result.takeError());
+  auto it = responseHandlers.find(debugString(id));
----------------
modocache wrote:

Indeed, clangd appears to remove the entry. See here: https://github.com/llvm/llvm-project/blob/93de97d750548cd90c53efd4367dbd0367aa30fd/clang-tools-extra/clangd/ClangdLSPServer.cpp#L264-L265

I'll do the same.

https://github.com/llvm/llvm-project/pull/90078


More information about the Mlir-commits mailing list