Make set-lookup-handlers! additive

Consecutive calls to set-lookup-handlers! would redefine *all* lookup
handlers, unsetting unspecified ones, so you were forced to redefine all
handlers, even if you only wanted to change one. No more. Its side
effects are now additive.

Also adds :async handler support, however, due to their nature, they
cannot fall back to other handlers (there's no reliable way to detect
they worked or not).

To get around this, write a blocking wrapper around the old async method
and register it as a non-async handler.
This commit is contained in:
Henrik Lissner 2019-01-08 00:33:38 -05:00
parent 25b9a90c12
commit 37cb0e178c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 66 additions and 40 deletions

View file

@ -148,7 +148,7 @@
(setq-default company-backends (delq 'company-tide (default-value 'company-backends))))
(set-company-backend! 'tide-mode 'company-tide)
;; navigation
(set-lookup-handlers! 'tide-mode
(set-lookup-handlers! 'tide-mode :async t
:definition #'tide-jump-to-definition
:references #'tide-references
:documentation #'tide-documentation-at-point)