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

Add support for specifying schema via `# $schema: …`

Open pascal-hofmann opened this issue 1 year ago • 4 comments

Is your enhancement related to a problem? Please describe.

JetBrains recently added support for specifying YAML schema via inline comment to their products. This looks similar to the modeline that can be used for yaml-language-server.

# $schema: …

Examples:

# $schema: https://example.com/path/to/schema.json
# $schema: ./schema.json

Describe the solution you would like

It would be great if yaml-language-server would support both ways (existing modeline, plus $schema: …) of specifying the schema inline, so we don't have to specify it twice.

Describe alternatives you have considered

None.

Additional context

pascal-hofmann avatar Apr 09 '24 14:04 pascal-hofmann

duplicate #950

jeremyfiel avatar Jul 31 '24 19:07 jeremyfiel

duplicate #959

This is #959.

Did you mean #964?

pascal-hofmann avatar Jul 31 '24 19:07 pascal-hofmann

Currently it's not quite a duplicate of #950 as they made a crucial mustake that actually makes it incompatible with JetBrains' IDEs (= instead of :).

cromefire avatar Aug 04 '24 19:08 cromefire

duplicate #950

No, #950 is about getting the schema from inside the data strucutre, without using a modeline:

$schema: ./schema.json
foo: "1"

This issue is about adjusting the modeline parser to allow more relaxed forms of the schema declaration (ie: without the yaml-language-server guff) when using a modeline (aka: special comment):

# $schema: ./schema.json
foo: "1"

tysonclugg avatar Aug 20 '24 17:08 tysonclugg