[PATCH] D32234: [Clangd] Support Authority-less URIs
Marc-Andre Laperle via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 19 13:35:44 PDT 2017
malaperle-ericsson updated this revision to Diff 95809.
malaperle-ericsson added a comment.
Add test
https://reviews.llvm.org/D32234
Files:
clangd/Protocol.cpp
test/clangd/completion.test
Index: test/clangd/completion.test
===================================================================
--- test/clangd/completion.test
+++ test/clangd/completion.test
@@ -20,6 +20,16 @@
# CHECK-DAG: {"label":"bb","kind":5}
# CHECK-DAG: {"label":"ccc","kind":5}
# CHECK: ]}
+Content-Length: 146
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:/main.cpp"},"position":{"line":3,"character":5}}}
+# Test authority-less 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
@@ -25,6 +25,8 @@
URI Result;
Result.uri = uri;
uri.consume_front("file://");
+ // Also trim authority-less URIs
+ uri.consume_front("file:");
// For Windows paths e.g. /X:
if (uri.size() > 2 && uri[0] == '/' && uri[2] == ':')
uri.consume_front("/");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32234.95809.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170419/8e7cefc7/attachment.bin>
More information about the cfe-commits
mailing list