redhat-developer/vscode-yaml

Extension file system watchers

Open

#190 geöffnet am 1. Juli 2019

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (259 Forks)auto 404
buggood first issue

Repository-Metriken

Stars
 (820 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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