[FileSystem] Only watch opened file

There is one VSCode watch issue on Linux. The Linux users need set watch limit number manually. I found on GitPod max_user_watches is set to maximum value.

$ cat /proc/sys/fs/inotify/max_user_watches

Another option is use “files.watcherExclude” settings. This need users do it by themselves.

However, it seems these methods just a workaround. A better solution may just watch opened files in workspace instead of all files as default (Files shown on File tree are also watched). Is theia provides it now or we could consider provide such feature in future?

[original thread by Jacky Deng]

We need to watch non open files, because it is part of the language server protocol to notify language servers about changes on non opened files.

[Jacky Deng]

Got it. Even though it seems watch source files are enough for LSP server scenario instead of all files in workspace. Of course, Theia could not decide which files are watched as a upstream project. It could be done in IDE customization process. Thanks for your explaination.

[Simon Marchi]

If the server supports dynamic registration of file watches, then we could avoid watching all the flies (for that reason)