[clangd] Lay JSONRPCDispatcher to rest.
authorSam McCall <sam.mccall@gmail.com>
Thu, 18 Oct 2018 12:32:04 +0000 (12:32 +0000)
committerSam McCall <sam.mccall@gmail.com>
Thu, 18 Oct 2018 12:32:04 +0000 (12:32 +0000)
commit2c30fbcac557ac258624a1d5c5f86f8b49848c86
tree0f43bcd484b7944da8015feacd158d081c5c6a88
parent4859738cfe58f3d8322fe81f123543791fa6c4de
[clangd] Lay JSONRPCDispatcher to rest.

Summary:
Most of its functionality is moved into ClangdLSPServer.
The decoupling between JSONRPCDispatcher, ProtocolCallbacks, ClangdLSPServer
was never real, and only served to obfuscate.

Some previous implicit/magic stuff is now explicit:
 - the return type of LSP method calls are now in the signature
 - no more reply() that gets the ID using global context magic
 - arg tracing no longer relies on RequestArgs::stash context magic either

This is mostly refactoring, but some deliberate fixes while here:
 - LSP method params are now by const reference
 - notifications and calls are now distinct namespaces.
   (some tests had protocol errors and needed updating)
 - we now reply to calls we failed to decode
 - outgoing calls use distinct IDs
A few error codes and message IDs changed in unimportant ways (see tests).

Reviewers: ioeric

Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits

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

llvm-svn: 344737
14 files changed:
clang-tools-extra/clangd/CMakeLists.txt
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/JSONRPCDispatcher.cpp [deleted file]
clang-tools-extra/clangd/JSONRPCDispatcher.h [deleted file]
clang-tools-extra/clangd/ProtocolHandlers.cpp [deleted file]
clang-tools-extra/clangd/ProtocolHandlers.h [deleted file]
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/tool/ClangdMain.cpp
clang-tools-extra/test/clangd/crash-non-added-files.test
clang-tools-extra/test/clangd/delimited-input-comment-at-the-end.test
clang-tools-extra/test/clangd/fixits-command.test
clang-tools-extra/test/clangd/rename.test
clang-tools-extra/test/clangd/spaces-in-delimited-input.test