dendron
dendron copied to clipboard
enhance(lookup): tab autocomplete in all lookup controls
enhance(lookup): tab autocomplete in all lookup controls
This change adds tab autocomplete to all lookup controls, as well as in the web extension.
Previously, if a command wanted tab autocomplete, it needed to implement an onAutoComplete interface, and then register itself with a singleton registrar during init. Any places that wanted to run the command would need to talk to the registrar and retrieve the right command instance out of it.
Instead, the mechanism now uses the vscode.event / eventEmitter pattern. If you want to get notified of when the 'tab' key gets hit, you just get an onAutocomplete event out of the registrar (still a singleton for now), and then register /unregister your own callback in your own class. This simplifies the flow a lot and makes it much easier to add tab autocomplete functionality anywhere.
Related: https://github.com/dendronhq/dendron/issues/2393
can we add tests for this?
tests added