This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Turn off implicit cancellation based on client capabilities
ClosedPublic

Authored by sammccall on Mar 11 2021, 4:44 AM.

Diff Detail

Event Timeline

sammccall created this revision.Mar 11 2021, 4:44 AM
sammccall requested review of this revision.Mar 11 2021, 4:44 AM
kadircet added inline comments.Mar 11 2021, 7:33 AM
clang-tools-extra/clangd/ClangdServer.h
153

this makes sense as is, but i wonder if we should lift this to LSPServer instead.

3.17 specs also introduce retryOnContentModified, which is supposed to be a list of RPC names. so if we decide to take that into account, rather than deciding on what's "transient" ourselves, having all of this hardcoded in clangdserver would be limiting.

We can accept a cancellation policy on all of the ClangdServer endpoints, have some sensible defaults in clangdlspserver, enable those to be overwritten by client specs on initialize. (or if we don't want to make them part of the signature i suppose we can make use of config/context, but ... yikes). WDYT?

sammccall added inline comments.Mar 11 2021, 8:05 AM
clang-tools-extra/clangd/ClangdServer.h
153

I thought about this, but I don't think it's better...

  • it's complicated and boilerplatey with the method names, way out of proportion to the value here
  • I think "will the client take care of cancellation" is actually the more pertinent question rather than "will the client retry if we cancel"
  • we want to disable this (entirely) in C++ embedders, and a boolean option is the simplest way to do that.
kadircet accepted this revision.Mar 11 2021, 9:28 AM

thanks, lgtm!

clang-tools-extra/clangd/ClangdServer.h
153

we want to disable this (entirely) in C++ embedders, and a boolean option is the simplest way to do that.

i think it should be okay for embedders to specify what behavior they want per action, but i agree with the other two points. thanks for the explanation!

This revision is now accepted and ready to land.Mar 11 2021, 9:28 AM
This revision was landed with ongoing or failed builds.Mar 16 2021, 4:27 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2021, 4:27 AM