redhat-developer / redhat-developer/vscode-yaml

Extension file system watchers

Open
#190 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.