yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

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

Open LnLcFlx opened this issue 1 year ago • 3 comments

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?

LnLcFlx avatar May 02 '24 11:05 LnLcFlx

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 avatar May 17 '24 13:05 bollwyvl

Opened #970.

bollwyvl avatar May 17 '24 17:05 bollwyvl

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

Also JetBrains' IDEs would be which are probably one of the other often used IDEs that are used with YAML files.

Only caveat though is that some tools GitLab CI don't like any extra key on their YAML and fail, but #959 would resolve that as well then.

cromefire avatar Aug 04 '24 19:08 cromefire