Open thanhvg opened 4 years ago
I ran into a similar issue today, is it possible to get alist
working with dynamic-collection
?
@dsdshcym I found a solution from lsp project. Basically ivy
can take a list of hashtable objects and you will have to define a transform function. I made small package for tide-mode
using this approach:
https://github.com/thanhvg/counsel-tide-nav/blob/master/counsel-tide-nav.el
It's not clean and it's not documented anywhere afaik. On this matter I would say ivy
's dynamic api is not intuitive as helm
.
FWIW, you can always look the key up in the alist to retrieve the value.
Hi, this could be a newbie question but I cannot find a workaround for my use case so far.
For a collection that is a
alist
when I useivy-read
without a:dynamic-collection
option I got the whole(cons . cell)
of thealist
element in the:action
callback. But when I add:dynamic-collection
the:action
callback will only get thecons
of thealist
element.For example
When I run
counsel-foo
and choose1
, the echo area will show:I got (1 . one)
which is expected.But when I run
counsel-foo-dynamic
and choose1
, the echo area will show:I got 1
, which is just thecar
of the element(1 . one)
.I am very confused by this behavior. Why can't dynamic action get the whole
alist
element? Thanks