redhat-developer/vscode-yaml

Extension file system watchers

Open

#190 创建于 2019年7月1日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)TypeScript (259 fork)auto 404
buggood first issue

仓库指标

Star
 (820 star)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南