[PATCH] D38225: [clangd] Fix missing "message" key when responding with unsupported method
This revision was automatically updated to reflect the committed changes. Closed by commit rL314119: [clangd] Fix missing "message" key when responding with unsupported method (authored by d0k). Repository: rL LLVM https://reviews.llvm.org/D38225 Files: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp clang-tools-extra/trunk/test/clangd/unsupported-method.test Index: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp === --- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp +++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp @@ -42,7 +42,7 @@ // Return that this method is unsupported. writeMessage( R"({"jsonrpc":"2.0","id":)" + ID + - R"(,"error":{"code":-32601}})"); + R"(,"error":{"code":-32601,"message":"method not found"}})"); } void Handler::handleNotification(llvm::yaml::MappingNode *Params) { Index: clang-tools-extra/trunk/test/clangd/unsupported-method.test === --- clang-tools-extra/trunk/test/clangd/unsupported-method.test +++ clang-tools-extra/trunk/test/clangd/unsupported-method.test @@ -0,0 +1,19 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 143 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":""}}} + +Content-Length: 92 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/jumpInTheAirLikeYouJustDontCare","params":{}} +# CHECK: {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"method not found"}} + +Content-Length: 44 + +{"jsonrpc":"2.0","id":2,"method":"shutdown"} Index: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp === --- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp +++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp @@ -42,7 +42,7 @@ // Return that this method is unsupported. writeMessage( R"({"jsonrpc":"2.0","id":)" + ID + - R"(,"error":{"code":-32601}})"); + R"(,"error":{"code":-32601,"message":"method not found"}})"); } void Handler::handleNotification(llvm::yaml::MappingNode *Params) { Index: clang-tools-extra/trunk/test/clangd/unsupported-method.test === --- clang-tools-extra/trunk/test/clangd/unsupported-method.test +++ clang-tools-extra/trunk/test/clangd/unsupported-method.test @@ -0,0 +1,19 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 143 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":""}}} + +Content-Length: 92 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/jumpInTheAirLikeYouJustDontCare","params":{}} +# CHECK: {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"method not found"}} + +Content-Length: 44 + +{"jsonrpc":"2.0","id":2,"method":"shutdown"} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38225: [clangd] Fix missing "message" key when responding with unsupported method
rwols added a comment. No, I don't have commit access. Feel free to merge. https://reviews.llvm.org/D38225 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38225: [clangd] Fix missing "message" key when responding with unsupported method
bkramer accepted this revision. bkramer added a comment. This revision is now accepted and ready to land. This looks good. Do you have commit access? https://reviews.llvm.org/D38225 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38225: [clangd] Fix missing "message" key when responding with unsupported method
rwols created this revision. The language server protocol dictates that a ResponseError should have a [message string][1] describing the error. This adds a simple message to the error and a simple test. [1]: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#response-message https://reviews.llvm.org/D38225 Files: clangd/JSONRPCDispatcher.cpp test/clangd/unsupported-method.test Index: test/clangd/unsupported-method.test === --- /dev/null +++ test/clangd/unsupported-method.test @@ -0,0 +1,19 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 143 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":""}}} + +Content-Length: 92 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/jumpInTheAirLikeYouJustDontCare","params":{}} +# CHECK: {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"method not found"}} + +Content-Length: 44 + +{"jsonrpc":"2.0","id":2,"method":"shutdown"} Index: clangd/JSONRPCDispatcher.cpp === --- clangd/JSONRPCDispatcher.cpp +++ clangd/JSONRPCDispatcher.cpp @@ -42,7 +42,7 @@ // Return that this method is unsupported. writeMessage( R"({"jsonrpc":"2.0","id":)" + ID + - R"(,"error":{"code":-32601}})"); + R"(,"error":{"code":-32601,"message":"method not found"}})"); } void Handler::handleNotification(llvm::yaml::MappingNode *Params) { Index: test/clangd/unsupported-method.test === --- /dev/null +++ test/clangd/unsupported-method.test @@ -0,0 +1,19 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 143 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":""}}} + +Content-Length: 92 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/jumpInTheAirLikeYouJustDontCare","params":{}} +# CHECK: {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"method not found"}} + +Content-Length: 44 + +{"jsonrpc":"2.0","id":2,"method":"shutdown"} Index: clangd/JSONRPCDispatcher.cpp === --- clangd/JSONRPCDispatcher.cpp +++ clangd/JSONRPCDispatcher.cpp @@ -42,7 +42,7 @@ // Return that this method is unsupported. writeMessage( R"({"jsonrpc":"2.0","id":)" + ID + - R"(,"error":{"code":-32601}})"); + R"(,"error":{"code":-32601,"message":"method not found"}})"); } void Handler::handleNotification(llvm::yaml::MappingNode *Params) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits