[PATCH] D53286: [clangd] Refactor JSON-over-stdin/stdout code into Transport abstraction.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 15 05:41:20 PDT 2018


sammccall created this revision.
sammccall added reviewers: jkorous, ioeric, hokein.
Herald added subscribers: cfe-commits, kadircet, arphaman, MaskRay, ilya-biryukov, mgorny.

This paves the way for alternative transports (mac XPC, maybe messagepack?),
and also generally improves layering: testing ClangdLSPServer becomes less of
a pipe dream, we split up the JSONOutput monolith, etc.

This isn't a final state, much of what remains in JSONRPCDispatcher can go away,
handlers can call reply() on the transport directly, JSONOutput can be renamed
to StreamLogger and removed, etc. But this patch is sprawling already.

The main observable change (see tests) is that hitting EOF on input is now an
error: the client should send the 'exit' notification.
This is defensible: the protocol doesn't spell this case out. Reproducing the
current behavior for all combinations of shutdown/exit/EOF clutters interfaces.
We can iterate on this if desired.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53286

Files:
  clangd/CMakeLists.txt
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/JSONRPCDispatcher.cpp
  clangd/JSONRPCDispatcher.h
  clangd/JSONTransport.cpp
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/Transport.h
  clangd/tool/ClangdMain.cpp
  test/clangd/compile-commands-path-in-initialize.test
  test/clangd/compile-commands-path.test
  test/clangd/completion-snippets.test
  test/clangd/completion.test
  test/clangd/crash-non-added-files.test
  test/clangd/execute-command.test
  test/clangd/input-mirror.test
  test/clangd/signature-help.test
  test/clangd/textdocument-didchange-fail.test
  test/clangd/trace.test
  test/clangd/xrefs.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53286.169686.patch
Type: text/x-patch
Size: 44926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181015/384040e1/attachment-0001.bin>


More information about the cfe-commits mailing list