This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Extract binding of typed->untyped LSP handlers to LSPBinder. NFC
ClosedPublic

Authored by sammccall on Feb 11 2021, 1:48 PM.

Details

Summary

The goal is to allow the LSP bindings of features to be defined outside
the ClangdLSPServer class, turning it into less of a monolith.

Diff Detail

Event Timeline

sammccall created this revision.Feb 11 2021, 1:48 PM
sammccall requested review of this revision.Feb 11 2021, 1:48 PM
sammccall updated this revision to Diff 323321.Feb 12 2021, 7:07 AM

Rebase and include commands after D96507

[clangd] Allow modules to bind LSP methods/notifications/commands.

whoops, meant to create a new review for that followup change, not update this one...

Revert to previous version

Add doc comments to bind methods

kadircet accepted this revision.Feb 15 2021, 1:21 AM

LGTM, thanks! (I wish outgoing calls were not so different :/)

clang-tools-extra/clangd/ClangdLSPServer.cpp
173–180

why not keep the old lookup style ? since handlers are unique_functions, checking for null should still suffice (and be cheap)

clang-tools-extra/clangd/LSPBinder.h
68

s/peek/load

clang-tools-extra/clangd/unittests/LSPBinderTests.cpp
19

please fix

21

please fix

26

please fix (we usually follow camelCase for json-serializable types in clangd, but i don't think it is worth doing in tests)

29

nit: s/P/P.field("x")

52

please fix, and maybe have a counter, in addition to last value to check for "invalid type" case?

70

nit: ASSERT_THAT(Reply.hasValue())

here and elsewhere

This revision is now accepted and ready to land.Feb 15 2021, 1:21 AM
This revision was landed with ongoing or failed builds.Feb 15 2021, 1:51 AM
This revision was automatically updated to reflect the committed changes.
sammccall marked 7 inline comments as done.