redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.01k stars 244 forks source link

Use schema from `"$schema":` for current JSON file #964

Open LnLcFlx opened 2 months ago

LnLcFlx commented 2 months ago

I am using with nvim-lspconfig for editing a JSONC file like this. When I add a modeline like # yaml-language-server: $schema=https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json I get the desired LSP functionalities. But when I only use "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json" instead of the modeline, like suggested in the link above, it does not work.

What am I doing wrong?

bollwyvl commented 1 month ago

Yes, also recently encountered this.

Having to suggest "only-works-in-this-tool" magic comments feels fairly antithetical to encouraging use of schema conventions.

For reference, other JSON-adjancent tools such as taplo support $schema.

bollwyvl commented 1 month ago

Opened #970.