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

fix(actions.qflist): make it work with vim quickfix commands #1742

Merged
merged 1 commit into from
Feb 13, 2022

Conversation

cgsheeh
Copy link
Contributor

@cgsheeh cgsheeh commented Feb 10, 2022

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).

…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`).
@kkharji
Copy link
Member

kkharji commented Feb 12, 2022

🤔 hmmm I get how practical it is to have new items added to an existing list. But I have a feeling that maybe it should rather be a global option or new function. The thing is many users of telescope expect the behavior of having new quickfix list on send_to_quickfix, like me.

Since it's vim default behavior, then it should be the default here, however, with an way for current users to opt-out this change.

Otherwise, LGTM. btw great argument #1739

@cgsheeh
Copy link
Contributor Author

cgsheeh commented Feb 12, 2022

The thing is many users of telescope expect the behavior of having new quickfix list on send_to_quickfix, like me.

@tami5 Just to clarify, after this change you will still see a new quickfix list on send_to_quickfix. The difference is the previous quickfix list will now be in the quickfix list stack, recoverable with :colder after you send another Telescope query to the quickfix list (and the same change is true of the location list). The current behaviour of send_to_quickfix is to remove all the existing entries in the current quickfix list and replace them with the new entries. You can already use add_selected_to_qflist to append to the current quickfix list (with <M-Q> IIRC). See :h setqflist, the section on actions. Confusingly the ' ' action is in a paragraph at the end instead of formatted similarly to the r and a actions (which is perhaps a bug in and of itself).

Apologies in advance if you already understood all this, just want to make sure we're on the same page. If you could pull down the PR and give it a try I'd greatly appreciate it!

@kkharji kkharji self-assigned this Feb 12, 2022
Copy link
Member

@kkharji kkharji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, I totally misunderstood it as feature rather than a bug. I did some testing and indeed no big behavior changes to what the user would expected. but rather an access to a new suite of quickfix driven workflows.

Thanks for the clarification @cgsheeh

@kkharji kkharji changed the title actions: switch mode from r to when sending to quickfix list (#1739) fix(actions.qflist): make it work with vim quickfix commands Feb 13, 2022
@kkharji kkharji merged commit 88229d5 into nvim-telescope:master Feb 13, 2022
@cgsheeh cgsheeh deleted the sendtoqf_new_list branch February 13, 2022 00:13
osamuaoki added a commit to osamuaoki/telescope.nvim that referenced this pull request 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants