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

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 28 17:45:07 PST 2022


nridge added a comment.

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

> I tried 3 consumers (`ajv-cli`, `yaml-language-server`, and `yajsv`) and **hit different blocking bugs in all of them** when using obvious, spec-compliant approaches to writing schemas.

Thanks for experimenting. Happy to defer to your judgment on the best course of action given this state of affairs (and also the mentioned difficulty in accessing these tools from an LLVM test suite).

> I've taken a shot at this and have something almost working: https://reviews.llvm.org/D140745.

Neat!



================
Comment at: clang-tools-extra/clangd/schema/config.json:20
+  "properties": {
+    "If": {
+      "description": "Conditions in the If block restrict when a fragment applies.",
----------------
sammccall wrote:
> disabling `additionalProperties` probably yields useful diagnostics
One question here is, do we want diagnostics from the schema validation to duplicate or replace clangd's own diagnostics for the config file?


================
Comment at: clang-tools-extra/clangd/schema/config.json:25
+        "PathMatch": {
+          "description": "The file being processed must fully match a regular expression.",
+          "$ref": "#/$defs/stringOrArrayOf"
----------------
sammccall wrote:
> Unfortunately it's not valid to specify description together with $ref (implementations are required to ignore it)
> 
> https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-01#section-8.3
Hmmm... the spec draft at https://json-schema.org/draft/2020-12/json-schema-core.html#section-8.2.3.1, which is newer (2022 rather than 2018) does not seem to have this wording, and the example at https://json-schema.org/learn/getting-started-step-by-step.html#references uses `$ref` together with `description`.


================
Comment at: clang-tools-extra/clangd/schema/config.json:172
+        },
+        "ParameterNames": {
+          "description": "A boolean that enables/disables inlay-hints for parameter names in function calls.",
----------------
sammccall wrote:
> hmm, there are two more categories here - were they missing somewhere?
`Designators` is missing from https://clangd.llvm.org/config.html#inlayhints

What's the other one?


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