[PATCH] D140462: [clangd] Add schema for `.clangd` config

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 22 06:19:17 PST 2022


sammccall added a comment.

In D140462#4012451 <https://reviews.llvm.org/D140462#4012451>, @nridge wrote:

> Thanks, this is pretty neat!
>
> cc @sammccall as a heads up, just to make sure you're cool with having this in-tree

This has been discussed before, unfortunately while I *thought* it was on a bug, it was actually in a PR: https://github.com/clangd/vscode-clangd/pull/140

I don't think it's a good idea to add a third (arguably, fourth/fifth) place that the config structure and documentation must be maintained by hand, especially one that constrains the structure in non-obvious ways. This needs to be automatically generated.

This implies moving the source of truth to something we can generate {fragment struct, website, parsing code, YAML schema} from.)

I made an attempt at this in https://reviews.llvm.org/D115425 using TableGen, which is the closest LLVM has to a standard way to do this, but the language is pretty bad (for this purpose).
YAML itself is the best alternative we came up with to express the schema in. Using the JSON-schema itself as the source of truth is another interesting option, though it might be simpler to have a format we control.
My recollection was that I thought this was valuable to solve in one way or other, and @kadircet (whose call it is now, really) didn't see it as a high priority.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140462/new/

https://reviews.llvm.org/D140462



More information about the cfe-commits mailing list