Description
We ask editors to watch Ruby files for us here, which we use to update the codebase index upon modifications.
However, the registration may fail in two ways: some editors don't support dynamic feature registration and some don't support file watching. In those cases, only the declarations from the original indexing will be available since we will never receive the modification events.
We can use the listen gem to provide a fallback and listen to modifications from the server when file watching is not available.
This is suboptimal from a performance standpoint since having the editor watch files means that it can broadcast the modification events to all parties interested in handling those - as opposed to having each server watch files on their own. However, it's better than never updating the index.
Questions
File watching is available for VS Code. Is it also available for other popular editors such as NeoVim, Emacs, Sublime?
Implementation suggestion
My suggestion is adding an else statement where we register for file watching. In the else branch, we would:
- Require the listen gem
- Use listen to register the callbacks for when files are modified
We should evaluate if there's any way to share the current handler for modifications, with the one using listen.