redhat-developer / redhat-developer/vscode-yaml

Pick the best schema for the available file

Open
#884 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Is your enhancement related to a problem? Please describe.

GitHub has issue templates. These templates are stored in .github/ISSUE_TEMPLATE/*.{yaml,yml}.

I have my current schema setting as:

"yaml.schemas": {
  "https://json.schemastore.org/github-issue-forms.json": ".github/ISSUE_TEMPLATE/*",
}

Now say I want to add support for GitHub issue forms by adding a .github/ISSUE_TEMPLATE/config.{yaml,yml}.

"yaml.schemas": {
  "https://json.schemastore.org/github-issue-config.json": ".github/ISSUE_TEMPLATE/config.yaml",
  "https://json.schemastore.org/github-issue-forms.json": ".github/ISSUE_TEMPLATE/*",
}

With this configuration, opening .github/ISSUE_TEMPLATE/config.{yaml,yml}, leads to multiple schemas being loaded.

image

Describe the solution you would like

I see a 2 options to support this.

  1. Use the order in which the schemas/patterns are defined to pick the schema which should be applied.
  2. Pick the best match. .github/ISSUE_TEMPLATE/config.{yaml,yml} fully matches .github/ISSUE_TEMPLATE/config.{yaml,yml} whereas it required a glob to match .github/ISSUE_TEMPLATE/*.
Describe alternatives you have considered

Taking this setting out of my user settings.json and moving it to each individual workspace's settings where I can enumerate the exact names of the issue templates. This isn't scalable in my opinion.

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

Start by tracing how the vscode-yaml extension resolves yaml.schemas patterns for files under .github/ISSUE_TEMPLATE. Compare the exact config.yaml match with the broader template glob and inspect the related settings or schema-matching entry points. Done means config files use the best matching schema while other issue templates continue using the general schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.