The idea: you can type in AST matchers, and clangd shows you matches
within the document.
Syntax is like:
#pragma clang query varDecl().bind("var")
Features:
- matches are shown within the document as diagnostics
- find-references on the pragma will produce a list of matches
- errors within matchers are shown as diagnostics
- code completion is available within matchers
Demo: https://asciinema.org/a/O63vj8af7c8RcgcCqKvhH2TRn
There are some rough edges here, e.g. the diagnostics are warnings and
have no LSP diagnostic code, the diagnostic text for matcher errors
isn't ideal etc.
I think this is a good start as-is and we can work out if we want to
improve these cases later, if this feature ends up being useful.