redhat-developer / redhat-developer/vscode-yaml
Extension file system watchers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
In extension.ts when the client options are created, these parameters are passed in:
fileEvents: [
workspace.createFileSystemWatcher('**/*.?(e)y?(a)ml'),
workspace.createFileSystemWatcher('**/*.json')
]
I am not really sure what the first FileSystemWatcher does - commenting it out does not break language server functionality (on the server side, the documents.onDidChangeContent listener events still get fired whenever a change occurs).
If I am not mistaken, the functionality that changes is for the connection.onDidChangeWatchedFile server-side listener, which is only used to reload JSON schemas, when they are changed.
I believe that a FileSystemWatcher might be necessary here to restrict what files are monitored (e.g. to only specific filename patterns), but that is not the needed, as we want to validate all workspace YAML files.
Even if it is necessary for some reason, then I don't think it functions as intended. The VS Code API (https://code.visualstudio.com/api/references/vscode-api#GlobPattern) does not document any support for optional pattern syntax (?(pattern)) in glob patterns.
Testing with workspace.findFiles('**/*.?(e)y?(a)ml') shows that no results are returned, even with an open workspace full of files with .yaml extension.
workspace.findFiles('**/*.{ey,y}{m,am}l') seems to work instead, so a workaround would be to replace the FileSystemWatcher glob pattern with this one.
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
Start in extension.ts at client option creation and inspect both FileSystemWatcher glob patterns, then compare their behavior with workspace.findFiles. Check the connection.onDidChangeWatchedFile path used for JSON schema reloads. Done means the watcher pattern matches workspace YAML files and preserves the intended schema-reload behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100