[PATCH] D32238: [Clangd] Failed to decode params using 1.x-compatible request message

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 19 13:48:00 PDT 2017


malaperle-ericsson updated this revision to Diff 95811.
malaperle-ericsson added a comment.

Add test


https://reviews.llvm.org/D32238

Files:
  clangd/Protocol.cpp
  test/clangd/completion.test


Index: test/clangd/completion.test
===================================================================
--- test/clangd/completion.test
+++ test/clangd/completion.test
@@ -20,6 +20,17 @@
 # CHECK-DAG: {"label":"bb","kind":5}
 # CHECK-DAG: {"label":"ccc","kind":5}
 # CHECK: ]}
+
+Content-Length: 172
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"uri":"file:///main.cpp","position":{"line":3,"character":5}}}
+# Test params parsing in the presence of a 1.x-compatible client (inlined "uri")
+#
+# CHECK: {"jsonrpc":"2.0","id":1,"result":[
+# CHECK-DAG: {"label":"a","kind":5}
+# CHECK-DAG: {"label":"bb","kind":5}
+# CHECK-DAG: {"label":"ccc","kind":5}
+# CHECK: ]}
 Content-Length: 44
 
 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
Index: clangd/Protocol.cpp
===================================================================
--- clangd/Protocol.cpp
+++ clangd/Protocol.cpp
@@ -646,7 +646,7 @@
     auto *Value =
         dyn_cast_or_null<llvm::yaml::MappingNode>(NextKeyValue.getValue());
     if (!Value)
-      return llvm::None;
+      continue;
 
     llvm::SmallString<10> Storage;
     if (KeyValue == "textDocument") {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32238.95811.patch
Type: text/x-patch
Size: 1214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170419/73c40ccd/attachment.bin>


More information about the cfe-commits mailing list