redhat-developer / redhat-developer/vscode-yaml

Nested glob patterns match paths above them that they shouldn't

Open
#1,054 0 comments 3 reactions 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

Describe the bug

I am trying to match files that have the same names, using folder depth to determine which schema to use.

Expected Behavior

I should be able to use glob patterns to determine the depth of a file, ex : foo/*/*/*/*.bar and match only files at that folder depth

Current Behavior

It matches the depth I want, but also the one directly above it.

Steps to Reproduce

  1. go in settings.json of workspace and configure these settings:
    {
    "yaml.schemas":{
    "./.lsp/thing1.properties.schema.json": "rootDir/*/filewithsamename.yaml",
    "./.lsp/thing2.properties.schema.json": "rootDir/*/*/filewithsamename.yaml",
    "./.lsp/thing3.properties.schema.json": "rootDir/*/*/*/filewithsamename.yaml",
    "./.lsp/thing4.properties.schema.json": "rootDir/*/*/*/*/filewithsamename.yaml",
    "./.lsp/thing5.properties.schema.json": "rootDir/*/*/*/*/*/filewithsamename.yaml"}
    }

  2. Look at some example file matches, they will match the correct file to the correct schema, but also the one above it.

Environment

  • VS Code Version: 1.90.0
  • OS : Fedora Linux 38
  • Extension version : 1.15.0

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 reproducing the issue in workspace settings.json with the nested glob patterns and same-named YAML files described above. Trace the schema matching entry point used by the VS Code extension and verify that each pattern matches only its intended folder depth, without also matching the parent path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.