Skip to content
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

Telescope should make use of the quickfix list stack #1739

Closed
cgsheeh opened this issue Feb 9, 2022 · 4 comments
Closed

Telescope should make use of the quickfix list stack #1739

cgsheeh opened this issue Feb 9, 2022 · 4 comments
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@cgsheeh
Copy link
Contributor

cgsheeh commented Feb 9, 2022

Is your feature request related to a problem? Please describe.
Sometimes I make a search for A and send it to the quickfix list. Then I work a little more, and make another search for B, which I also send to the quickfix list. After that, I realize I need to see the results of my search for A again. Since I searched for B already, the quickfix list is overwritten and I need to re-open Telescope, search for A and re-send to the quickfix list.

I looked online for some extension that might solve this issue for me, but as it turns out this is already a feature of the quickfix list in Vim/Neovim! See this page and search for "Using more than one list of errors" (sorry, I can't figure out how to permalink the exact section). Neovim supports a stack of up to 10 quickfix lists, which can be moved between using :colder, :cnewer in a similar fashion to :cnext and :cprev.

Describe the solution you'd like
So the feature request (bug?) is that Telescope should be sending results to new quickfix lists instead of replacing all entries in the current quickfix list.

Describe alternatives you've considered
Alternatively we could create a new mapping that specifically sends results to a new quickfix list, keeping "overwrite all existing entries in the current list" as the default.

Additional context
I'm a relative newbie to Neovim and its rapidly evolving ecosystem, so it's possible there is a better solution that I haven't considered. I've never actually used the quickfix stack before so I might also be wrong about it's usefulness here. If I'm way off the mark here or there's a much better workflow I haven't been made aware of, please point me in the right direction!

I took a brief look at the code and it seems when Telescope calls setqflist it always passes 'r' as the mode on "send to qf list", when it should probably pass '' to create a new list. I'd be interested in taking this on as a contribution if it would be accepted into the codebase.

@cgsheeh cgsheeh added the enhancement Enhancement to performance, inner workings or existent features label Feb 9, 2022
@cgsheeh
Copy link
Contributor Author

cgsheeh commented Feb 10, 2022

I took a brief look at the code and it seems when Telescope calls setqflist it always passes 'r' as the mode on "send to qf list", when it should probably pass '' to create a new list. I'd be interested in taking this on as a contribution if it would be accepted into the codebase.

I tried this last night and it works as expected. I'll send it as a PR shortly. As a follow up I might also write a picker for searching through the stack entries (ie a picker for :chistory).

Not entirely sure if this would constitute a BC change. It appears Telescope has abstracted around the quickfix list as a single list instead of a stack, and that users of any send_*_to_qf function are assuming their old entries will be removed when called. Technically that is still true after this change, so I'd probably just ship it, but again I don't have enough context to make that call. :)

cgsheeh added a commit to cgsheeh/telescope.nvim that referenced this issue Feb 10, 2022
…vim-telescope#1739)

Changes functions that use `setqflist` in `r` mode to instead use
` ` mode. This makes the Telescope quickfix list action send results
to a new list in the quickfix stack instead of overwriting the
entries in the current stack. Doing so enables `:chistory`, `:colder`
and `:cnewer` functions to review results of previous Telescope
queries.

The location list uses a similar API and is updated in this PR also
(ie this also enables `:lhistory`, `:lolder` and `:lnewer`).
cgsheeh added a commit to cgsheeh/telescope.nvim that referenced this issue Feb 10, 2022
…vim-telescope#1739)

Changes functions that use `setqflist` in `r` mode to instead use
` ` mode. This makes the Telescope quickfix list action send results
to a new list in the quickfix stack instead of overwriting the
entries in the current list. Doing so enables `:chistory`, `:colder`
and `:cnewer` functions to review results of previous Telescope
queries.

The location list uses a similar API and is updated in this PR also
(ie this also enables `:lhistory`, `:lolder` and `:lnewer`).
@cgsheeh
Copy link
Contributor Author

cgsheeh commented Feb 13, 2022

The first PR which enables Telescope using the quickfix list stack has landed. Nice!

I'm going to keep this open as I plan to hack on this a little more. As I mentioned previously I think having a picker for the quickfix list stack would be a nice feature. We may also be able to leverage the what dict passed to setqflist to add the Telescope query as the title of the quickfix list in the stack, which would make search much easier.

@Conni2461
Copy link
Member

we are currently not looking for new pickers. See #1228

We can expose the local function send_selected_to_qf in the actions/init.lua?

@cgsheeh
Copy link
Contributor Author

cgsheeh commented Feb 16, 2022

we are currently not looking for new pickers. See #1228

Ah okay, I won't bother adding it then. :chistory has been sufficient for me anyways. :)

Thanks for all your work on Telescope, it's great!

@cgsheeh cgsheeh closed this as completed Feb 16, 2022
osamuaoki added a commit to osamuaoki/telescope.nvim that referenced this issue Jun 26, 2024
DON'T EXPECT THIS TO BE UPSTREAMED due to:

* nvim-telescope#1228
* https://github.com/nvim-telescope/telescope.nvim/blob/master/CONTRIBUTING.md

THIS IS MY PERSONAL changes.

port original patch for quickfixhistory picker while considering file name changes etc.

* 8d1841b ("feat: quickfixhistory picker (nvim-telescope#1878)", 2022-05-04)
* 0621c1c ("break: prefix internal files and add deprecation messages (nvim-telescope#2032)", 2022-07-01)

Related:

* nvim-telescope#1739
* nvim-telescope#1742
* https://github.com/cgsheeh/telescope.nvim (forked repo)

TODO: make this external

https://github.com/nvim-telescope/telescope.nvim/blob/master/developers.md

Signed-off-by: Osamu Aoki <osamu@debian.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

No branches or pull requests

2 participants