Skip to content

ivy-update-candidates: support alists #2715

@nbfalcon

Description

@nbfalcon

ivy-update-candidates currently errors if an alist is passed to it. This breaks my lsp-ivy refactor.

The problem lies in ivy--format-minibuffer-line, which calls copy-sequence on its argument, which is an element of the CANDS list passed to ivy-update-candidates. copy-sequence expects a string, not a cons, so errors out. The fix is trivial, a single line at the start of ivy--format-minibuffer-line that checks if the element is a cons or a string:

(str (if (consp str) (car str) str))

However, I am unsure whether this is the right way to go about this, because it is a bit ad-hoc: ivy-update-candidates would not behave consistently with ivy-read, as its CANDS field cannot be a hash-table, .... Also, it has no docstring, meaning it is unclear what format its CANDS field should have. I'd like to not have to resort to text-properties for this.

I have provided a PR with my proposal. Copyright shouldn't be an issue, as a single line (my first contribution to this project) is < 15 lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions