[clangd] Allow all LSP methods to signal cancellation via $/cancelRequest
authorSam McCall <sam.mccall@gmail.com>
Thu, 13 Sep 2018 12:58:36 +0000 (12:58 +0000)
committerSam McCall <sam.mccall@gmail.com>
Thu, 13 Sep 2018 12:58:36 +0000 (12:58 +0000)
commit45be5cf0edd40426b6e8814d9b6814a6b62c722e
tree219f2373ca408917f30e23c5a333f2867cf8756a
parent76b88d8e98401902189d78f710163edf7654ace6
[clangd] Allow all LSP methods to signal cancellation via $/cancelRequest

Summary:
The cancelable scopes are managed by JSONRPCDispatcher so that all Handlers
run in cancelable contexts.
(Previously ClangdServer did this, for code completion only).

Cancellation request processing is therefore also in JSONRPCDispatcher.
(Previously it was in ClangdLSPServer).

This doesn't actually make any new commands *respect* cancellation - they'd
need to check isCancelled() and bail out. But it opens the door to doing
this incrementally, and putting such logic in common machinery like TUScheduler.

I also rewrote the ClangdServer class/threading comments because I wanted to
add to it and I got carried away.

Reviewers: ilya-biryukov, kadircet

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 342135
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/JSONRPCDispatcher.cpp
clang-tools-extra/clangd/JSONRPCDispatcher.h
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/Protocol.h
clang-tools-extra/clangd/ProtocolHandlers.cpp
clang-tools-extra/clangd/ProtocolHandlers.h