-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's difficult to monitor file changes correctly #742
Comments
There is always the possibility that the server does its own file watching without asking the client for events. |
I'm glad to see that you've added a file operations protocol. The new protocol solves the problem of renaming, but the support for folders is still unfriendly. At present, if I delete or rename a folder, the protocol only informs the server of the change of the folder (and only provides a URI, which does not indicate whether the URI is a folder or a file). In fact, most language services don't care about folders. Files are the basic units. Therefore, I hope that the protocol of file operation can be further strengthened in the future. For example, the option can be added to let the client split the folder event into internal file events (for example, when a folder with 10 files is deleted, the URI of these 10 internal files will be provided in the deletion event). Finally, thank you for your work! |
I found that file events protocol only responds to VSCode operations, not external file operations. In the real environment, people often create new files because of pulling git. At this time, new files cannot trigger file events protocol. Is this the design? If the design is like this, the file events protocol may not be able to meet my needs. |
The design is like this since it allows to return additional edits in case of a rename (see the will*) requests. The file operations are not a replacement of the file events. Most file system don't provide you with events and of the children even a folder is renamed. If clients might not know the children since the node might have never be presented in an explorer. Scanning the whole file system on the client to simple provide these fine grain events is IMO not the right solution. Since a server knows the files that are loaded into a project it IMO can "easily" compute this itself. |
Thank you for your patience and help. I will change to the server to deal with this problem. You are free to close this issue. |
@sumneko thanks for getting back. Closing. |
To support global variables, the server needs to monitor all file additions and deletions, so I use the
workspace/didChangeWatchedFiles
to do that.However, this protocol is difficult to use correctly, for example:
User's operation
Expected to receive
Actually received
IO
myself.I have read some other issues like microsoft/vscode-languageserver-node#141, it seems that this is your design, but this design is very difficult to use, even in addition to the server's own
IO
, there is no good way to determine whether to add files or folders.The text was updated successfully, but these errors were encountered: