Skip to content
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

Listen to file changes via watching #365

Closed
Gert-dev opened this issue Jan 27, 2018 · 3 comments
Closed

Listen to file changes via watching #365

Gert-dev opened this issue Jan 27, 2018 · 3 comments

Comments

@Gert-dev
Copy link
Owner

Atom 1.21 added functionality to watch files and folders in specific paths for changes. We should use this to send the appropriate reindex events.

The core currently provides no mechanism to remove files from the index, it automatically prunes the index on every folder index as compensation. This, however, results in weird edge cases where you remove a file from the workspace, but the class inside it remains available for a while (because the core did not pick it up yet).

In a language server scenario, the client has to do all the watching and send the appropriate events to the server anyway, so this is a step in the right direction in any case.

This will also obsolete the need for watching the Git repository for changes, though we'll have to test how this behaves with branch switching via Git.

@twifty
Copy link

twifty commented Mar 26, 2018

I have currently run into the edge case of getClassInfo returning false positives after the containing file was deleted. We certainly need a way of keeping the database in sync with the filesystem.

To be honest though, isn't this something the core should handle?

@Gert-dev
Copy link
Owner Author

That is indeed currently a bug as there is no one listening to these removals and the core doesn't pick them up until the next project reindex, which automatically prunes existing files - to mitigate this a bit.

At first I also thought this is something the core should handle, but the language server specification indicates the client should do the watching and send it to the server. This is now possible since a couple of Atom versions ago, hence this ticket. A couple of reasons for doing so are listed there as well.

Another reason would be that the server and client don't necessarily have to share the same filesystem (i.e. in remote scenario's). The LSP doesn't officially mention it but there is an extension about it floating about somewhere.

@Gert-dev
Copy link
Owner Author

This is implemented in master as a part of #460.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants