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

Edwin Kofler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 26 23:44:20 PST 2022


hyperupcall added a comment.

Thank you for the suggestions - I applied all of the fixes!

As someone who helps maintain a lot of the schemas <https://github.com/SchemaStore/schemastore> on schemastore, it's nice when schemas are in-tree with their respective project, but I totally understand that this can increase complexity, especially for the reasons stated.

In D140462#4014944 <https://reviews.llvm.org/D140462#4014944>, @sammccall wrote:

> given lack of any automation/tests.



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

> And perhaps, if someone contributes automated tests for the schema in the future, we could consider upgrading its status to "maintained" at that time?

If you would like me to add tests to verify the schema (for now or later?), is there a utility within LLVM to help do so? I saw TableGen was mentioned, but it sounds like the schema validation use case is a different issue.

In D140462#4014944 <https://reviews.llvm.org/D140462#4014944>, @sammccall wrote:

> One practical question: AIUI the main point of having this is so it can be provided to the VSCode YAML extension so it understands .clangd files. How does this work mechanically? Does it need to be part of the vscode-clangd repo instead?

I think it's worth mentioning that the JSON schema can be hosted anywhere. As already mentioned, the YAML extension automatically downloads and uses the schema if it finds a `.clangd` file, and the schema can point to an external URL. One example of that in practice is the xunit-2.2.json <https://github.com/SchemaStore/schemastore/blob/089a12d20b62d5d70b30388637162de35c6856ac/src/schemas/json/xunit-2.2.json> schema; it simply contains a `$ref` to the actual schema on xunit.net. Whether this schema goes in `clangd/schema/config.json`, `clangd/contrib/schema/config.json`, or in `vscode-clangd` - on the SchemaStore end, all I have to do is update `$ref`.


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