redhat-developer / redhat-developer/yaml-language-server

YAML `---` for "Multiple documents within a single stream" doesn't work [YAML Language Server]

Open
#946 12 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

[Originally reported as https://github.com/redhat-developer/vscode-yaml/issues/995, before I understood this really belongs more here.]

I wrote my first trivial JSON schema enola.schema.jsonc, like this:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.enola.dev/json-schema/enola_meta.schema.jsonc",
  "title": "Enola.dev Meta Model",
  "description": "See https://docs.enola.dev",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
      "description": "Short technical name of this Type."
    }
  },
  "required": ["name"]
}

Then I wrote an test.yaml file using that schema, like this:

# yaml-language-server: $schema=enola.schema.jsonc

name: enola.dev/url
doc: enola.md#URL

---
name: enola.dev/id
doc: enola.md#ID

Current Behavior

It does put a "red squiggle" on the first doc: enola.md#URL but not on the second doc: enola.md#ID.

In fact the 2nd name: enola.dev/id doesn't have the "hover" with the descriptionfrom the schema either.

It looks like the YAML --- syntax for "multiple documents within a single stream" isn't supported / doesn't work?

Expected Behavior

I expected it to flag the doc attribute as red in both my URL and ID attributes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with the provided enola.schema.jsonc and test.yaml examples, then inspect the YAML language-server entry points that handle schema validation and hover information for documents after ---. Confirm that both documents receive the schema diagnostics and property descriptions; the issue is done when the second document behaves like the first.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.