dendron icon indicating copy to clipboard operation
dendron copied to clipboard

enhance(lookup): tab autocomplete in all lookup controls

Open jonathanyeung opened this issue 3 years ago • 1 comments

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

jonathanyeung avatar Sep 21 '22 06:09 jonathanyeung

can we add tests for this?

kevinslin avatar Sep 22 '22 14:09 kevinslin

tests added

jonathanyeung avatar Sep 26 '22 09:09 jonathanyeung