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

Do not apply schema to child directories

Open
#349 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your enhancement related to a problem? Please describe.

I have a directory that has the following structure:

  • parent
    • child_folder
      • client1_folder
        • theme.yaml
      • client2_folder
        • theme.yaml
    • client1.yaml
    • client2.yaml

I have defined 2 schema files: the first should be applied to all yaml files directly in the parent directory (there is not a naming convention for the files), while the second should be applied to all files in parent's child directories, that are named theme.yaml. However the way the glob string is applied to the document paths, there doesn't seem to be a way to avoid application of a schema recursively.

Describe the solution you would like

I would like the server to either:

  • Only apply schemas recursively in a directory if a double * is used (e.g. foo/**/*.yaml or foo/**.yaml)
  • Be able to set a flag to disable recursive application of schemas for a directory

The first option is preferred, since it is more in line with the way glob strings are generally used.

Describe alternatives you have considered

I know I could use the inline schema technique to specify which schema to use for the file. In my case, I have many files in the parent folder, so this is not ideal.

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 schema glob strings are matched against document paths in the YAML language server. Compare the current recursive behavior with the requested single-directory and double-star cases; the work is done when schemas using a single * do not apply to child directories while ** patterns retain recursive matching.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, yaml
Domain
devtools, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.