[PATCH] D32234: [Clangd] Support Authority-less URIs
malaperle-ericsson added a comment. Thanks a lot! Repository: rL LLVM https://reviews.llvm.org/D32234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32234: [Clangd] Support Authority-less URIs
This revision was automatically updated to reflect the committed changes. Closed by commit rL300990: [Clangd] Support Authority-less URIs (authored by d0k). Changed prior to commit: https://reviews.llvm.org/D32234?vs=95809=96152#toc Repository: rL LLVM https://reviews.llvm.org/D32234 Files: clang-tools-extra/trunk/clangd/Protocol.cpp clang-tools-extra/trunk/test/clangd/completion.test Index: clang-tools-extra/trunk/test/clangd/completion.test === --- clang-tools-extra/trunk/test/clangd/completion.test +++ clang-tools-extra/trunk/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: clang-tools-extra/trunk/clangd/Protocol.cpp === --- clang-tools-extra/trunk/clangd/Protocol.cpp +++ clang-tools-extra/trunk/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("/"); Index: clang-tools-extra/trunk/test/clangd/completion.test === --- clang-tools-extra/trunk/test/clangd/completion.test +++ clang-tools-extra/trunk/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: clang-tools-extra/trunk/clangd/Protocol.cpp === --- clang-tools-extra/trunk/clangd/Protocol.cpp +++ clang-tools-extra/trunk/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("/"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32234: [Clangd] Support Authority-less URIs
bkramer added a comment. Still looking good. Will commit this soon. https://reviews.llvm.org/D32234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32234: [Clangd] Support Authority-less URIs
malaperle-ericsson added a comment. Benjamin, I added a test, do you still think it's OK? Thanks! https://reviews.llvm.org/D32234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32234: [Clangd] Support Authority-less URIs
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("/"); 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("/"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32234: [Clangd] Support Authority-less URIs
bkramer accepted this revision. bkramer added a comment. This revision is now accepted and ready to land. This is fine. Test case would be nice though. Repository: rL LLVM https://reviews.llvm.org/D32234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits