[Clangd] Failed to decode params using 1.x-compatible request message
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 21 Apr 2017 15:51:23 +0000 (15:51 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 21 Apr 2017 15:51:23 +0000 (15:51 +0000)
commitd3326a04e061f082798790f6befb097ddf4ffde3
treebcc8db44e690afa3be505e908f29fc753ecf0e44
parent8c3ba63d0763f0d3bceb299cf350ee592c5f7d44
[Clangd] Failed to decode params using 1.x-compatible request message

textDocument/completion sends a TextDocumentPositionParams message in the 2.x
and 3.x. But in 1.x it was instead a TextDocumentPosition with inlined
parameters. This means that the "uri" field is at the top level and not in
textDocument. Because of this, some clients that maintain compability with 1.x
have both uri and textDocument.uri. Clangd, however, early returns in the
presence of anything but 'textDocument' or 'position' which prevents a client
compatible with both 3.x and 1.x to work correctly. If Clangd was a bit more
permissive (no early return), clients implementing all the versions of the
protocol would work.

Patch by Marc-Andre Laperle!

Differential Revision: https://reviews.llvm.org/D32238

llvm-svn: 300991
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/test/clangd/completion.test