New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible new feature: append candidates periodically #340

Closed
justbur opened this Issue Jan 7, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@justbur
Contributor

justbur commented Jan 7, 2016

Using counsel-ag, if I type a string that's pretty common (~5k-10k candidates maybe) I see the collected notice at the bottom for a few seconds and then the minibuffer fills with candidates when the process is done. Obviously, I need to refine my search. I know that I need to refine it once that counter starts getting large, but I think it would be helpful to see the types of matches I'm getting right away.

So what I was thinking is what if you could configure ivy-read to collect all of the candidates but to start showing them as soon as you reach some number (I don't know 500 or so). That way you get visual feedback right away showing all of the bad matches you're getting and you can start thinking about how you want to refine the search immediately.

This question is inspired by how helm-ag works. Somehow helm-ag shows matches immediately, but keeps collecting remaining ones in the background.

@myrjola

This comment has been minimized.

Show comment
Hide comment
@myrjola

myrjola Jan 10, 2016

I second this proposal. ag can take quite a while to search larger projects e.g. the Linux kernel, so showing some intermediate results would be very helpful.

myrjola commented Jan 10, 2016

I second this proposal. ag can take quite a while to search larger projects e.g. the Linux kernel, so showing some intermediate results would be very helpful.

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jan 11, 2016

+1 for the proposal

zilongshanren commented Jan 11, 2016

+1 for the proposal

@justbur justbur referenced this issue Jan 11, 2016

Closed

spacemacs-ivy: Information and Suggestions #4540

6 of 6 tasks complete

@abo-abo abo-abo closed this in e23c175 Jan 12, 2016

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Jan 12, 2016

Owner

Please check. The candidate list should refresh every 0.5s and display ++ next to the number of candidates.

Owner

abo-abo commented Jan 12, 2016

Please check. The candidate list should refresh every 0.5s and display ++ next to the number of candidates.

@myrjola

This comment has been minimized.

Show comment
Hide comment
@myrjola

myrjola Jan 12, 2016

Wonderful work @abo-abo! Works like a charm.

myrjola commented Jan 12, 2016

Wonderful work @abo-abo! Works like a charm.

@justbur

This comment has been minimized.

Show comment
Hide comment
@justbur

justbur Jan 12, 2016

Contributor

Thanks @abo-abo I haven't played with it too much, but it's not as smooth as I would have hoped on my computer.

My first thought for an alternative was something like this.

(defvar counsel--async-lines 0)
(defvar counsel--async-line-threshold 1000)

(defun counsel--async-filter (process str)
  "Receive from PROCESS the output STR."
  (when (< counsel--async-lines counsel--async-line-threshold)
    (with-current-buffer (process-buffer process)
      (insert str)
      (setq counsel--async-lines
            (count-matches "\n" (point-min) (point-max)))
      (when (< counsel--async-lines counsel--async-line-threshold)
        (goto-char (point-min))
        (setq ivy--all-candidates
              (split-string (buffer-string) "\n" t))))
    (let ((ivy--prompt (format "%d++ ag:" counsel--async-lines)))
      (ivy--insert-minibuffer
       (ivy--format ivy--all-candidates)))))

I know I need to do the paperwork now.

Contributor

justbur commented Jan 12, 2016

Thanks @abo-abo I haven't played with it too much, but it's not as smooth as I would have hoped on my computer.

My first thought for an alternative was something like this.

(defvar counsel--async-lines 0)
(defvar counsel--async-line-threshold 1000)

(defun counsel--async-filter (process str)
  "Receive from PROCESS the output STR."
  (when (< counsel--async-lines counsel--async-line-threshold)
    (with-current-buffer (process-buffer process)
      (insert str)
      (setq counsel--async-lines
            (count-matches "\n" (point-min) (point-max)))
      (when (< counsel--async-lines counsel--async-line-threshold)
        (goto-char (point-min))
        (setq ivy--all-candidates
              (split-string (buffer-string) "\n" t))))
    (let ((ivy--prompt (format "%d++ ag:" counsel--async-lines)))
      (ivy--insert-minibuffer
       (ivy--format ivy--all-candidates)))))

I know I need to do the paperwork now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment