[clangd] Allow embedders some control over when diagnostics are generated.

Description

[clangd] Allow embedders some control over when diagnostics are generated.

Summary:
Through the C++ API, we support for a given snapshot version:

  • Yes: make sure we generate diagnostics for exactly this version
  • Auto: generate eventually-consistent diagnostics for at least this version
  • No: don't generate diagnostics for this version

Eventually auto should be debounced for better UX.

Through LSP, we force diagnostics for initial load (bypassing future debouncing)
and all updates follow the "auto" policy.

This is complicated to implement under the CancellationFlag design, so
rewrote that part to just inspect the queue instead.

It turns out we never pass None to the diagnostics callback, so remove Optional
from the signature. The questionable behavior of not invoking the callback at
all if CppFile::rebuild fails is not changed.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

Details

Committed
sammccallFeb 22 2018, 5:11 AM
Differential Revision
D43518: [clangd] Allow embedders some control over when diagnostics are generated.
Parents
rL325773: Merging r325687:
Branches
Unknown
Tags
Unknown