redhat-developer / redhat-developer/yaml-language-server
Improve fileMatch patterns to allow more granular use
Nobody has claimed this yet.
- 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.
At this moment fileMatch pattern is suffering from several limitations that make it impossible to write patterns that correctly identify Ansible file types.
Describe the solution you would like
To see a full list o patterns that can reliably be used to identify Ansible file types, look at https://github.com/ansible-community/ansible-lint/blob/master/src/ansiblelint/config.py#L14-L33
There are two missing feature that prevent that:
*expands as anything instead of current file.foo/*.ymlcurrently also matchingfoo/bar/*.ymlwhen instead it should not. The correct way to do it would be withfoo/**/*.ymlorfoo/*/*.yml, where the second one requires one sublevel folder but the first one allows none, one or many subfolders feel (aka the recursive one).- There is no support for
{...}, so a pattern like"**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}"}must be exploded to 8 different patterns in order to work with current fileMatch. You can easily see how we can endup with very long and hard to maintain patterns.
Describe alternatives you have considered
While for the second missing feature we can probable live with the extra inconvenience, there is no solution for the first one. That is directly affecting Ansible because Ansible has a layout where nested patterns are needed and we must be able to control the matching to a single folder depth
Additional context
The given examples of patterns are based on https://facelessuser.github.io/wcmatch/ which is a python matching library but they are not unique to them. At least the globstar (**) is part of the extended glob syntax. Based on https://en.wikipedia.org/wiki/Glob_(programming)#cite_note-bashpat-10 it seems that there are at least two popular JavaScript implementation that should support it: minimatch (npm) and micromatch (babel/yarn).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files or tests; start by locating the fileMatch implementation and its existing tests. Compare the requested *, **, and brace-expansion behavior with the Ansible examples and minimatch or micromatch references, then verify that nested paths and combined brace patterns match as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100