ruby-lsp
ruby-lsp copied to clipboard
Make completions available for newly-added symbols in unsaved files
Currently we only index when a file is saved, meaning that completions will be unavailable for newly-added symbols within the same file.
For example if you write:
class Widget
end
then type Wid, autocomplete will not suggest Widget as it's not yet indexed.
This could be unexpected, especially if people are coming from other editor setups which behave differently.
A couple of options that come to mind:
- Index the current file on changes
- Index the current file on-the-fly when the completion is triggered
For options we need to be a wary of the impact on performance while editing.
We should also consider the case of multiple unsaved files, with one referencing the other.