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

Show results correctly when sorting_strategy=ascending is set #978

Closed
wants to merge 1 commit into from
Closed

Show results correctly when sorting_strategy=ascending is set #978

wants to merge 1 commit into from

Conversation

JRasmusBm
Copy link
Contributor

@JRasmusBm JRasmusBm commented Jul 12, 2021

Why is the change needed?

See #840

When setting sorting_strategy to ascending, the wrong line range is
shown in the result making the result impossible to follow.

How is the need addressed?

What side-effects could the change have?

  • Can't think of any, are there better ways to do this?

Closes #840
Co-authored-by: yendreij yendreij@gmail.com

JRasmusBm added a commit to JRasmusBm/dotfiles that referenced this pull request Jul 12, 2021
**Why** is the change needed?

It was stopping me from being able to conduct searches.

**How** is the need addressed?

- nvim-telescope/telescope.nvim#840
- nvim-telescope/telescope.nvim#978
@Conni2461
Copy link
Member

I already said this in the issue, i can't reproduce. Also these changes so nothing for me, so technically i am fine with merging them but it seems that you have found the issue.

I am fine with setting a filetype for the results buffer, somewhere here

pcall(a.nvim_buf_set_option, prompt_bufnr, 'filetype', 'TelescopePrompt')
TelescopeResults as name?

Would also be good if other people that experienced this issue could confirm that this issue is caused by fastfold

@jedrzejboczar
Copy link
Contributor

I can confirm that disabling FastFold seems to solve the issue, though I have no idea how it could cause it. I tested by disabling FastFold and reverting the changes included in this PR, so it looks like that's just FastFold.

As a side note abour reproducing the issue, for me this problem happens only on large code bases (e.g. with 2162 files found by fd --type f | wc -l) and only as long as the filtering query results in more results than there are lines in the results window.

@JRasmusBm
Copy link
Contributor Author

@Conni2461 Thank you for taking the time 😄

Here's how I figured it out: I have a very modular vim config so when I realized that it was not straightforward to reproduce I thought it might be something in my config.

I then started with a minimal Telescope setup and that worked. Then I recursively deleted half of the files and checked if the problem persisted until I had narrowed it down to the one plugin. 😇

I agree that adding a file type and advising users to disable FastFold for the file type is probably the best solution, so I will change my PR to that. Should we also add it to the documentation somehow, or what is the best mechanism to help other people who stumble over the plugin config know what to do?

@Conni2461
Copy link
Member

I should have been more clear, i can not reproduce this without fastfold. Thats what i care about 😆 but if you both have this problem because fastfold is loaded then filetype is the better solution.

You can add it here https://github.com/nvim-telescope/telescope.nvim/wiki/Known-Issues-and-Troubleshooting

@JRasmusBm
Copy link
Contributor Author

JRasmusBm commented Jul 14, 2021

It's all good, that's how I understood you! 😄 I really like telescope and completely agree that we shouldn't add stuff to it that are unnecessary.

Like you said the best and smallest change is to add filetypes to the the result (and preview window for good measure). I'll make the change when I have time! Thanks for following up! 😇

@JRasmusBm
Copy link
Contributor Author

On second thought I won't change the preview filetype, it might be used to decide how to highlight that buffer 😇

@JRasmusBm
Copy link
Contributor Author

After some further reading I discovered that filetype skipping is broken in FastFold (Konfekt/FastFold#40).

I also read that the Neovim implementation of folds is more efficient anyways (https://www.reddit.com/r/neovim/comments/6fmddc/does_neovim_improve_on_vims_fold_implementation/) so I might actually just uninstall FastFold.

If @jedrzejboczar or someone else that has the issue wants to keep pushing for the change that's fine with me, but on consideration I'm happy to uninstall FastFold. 😇

JRasmusBm added a commit to JRasmusBm/dotfiles that referenced this pull request Jul 14, 2021
@Conni2461
Copy link
Member

Filetype for Previewer is indeed more difficult, i would skip that. But can you please add the filetype for the Results buffer none the less? We have a similar issue with #991 and then we should probably disable folds for that filetype.

Would be cool if you could do that :) thanks

@JRasmusBm
Copy link
Contributor Author

@Conni2461 I'll definitely do that, but since that doesn't address #840 I will create a separate PR for that.

We should probably make a decision whether to merge this PR or to close #840 as a wontfix, though. 😇

**Why** is the change needed?

See #840

When setting sorting_strategy to ascending, the wrong line range is
shown in the result making the result impossible to follow.

**How** is the need addressed?

-   Basically adding the
    [fix](#840 (comment)) that @jedrzejboczar suggested in the
    issue.

What **side-effects** could the change have?

- Can't think of any, are there better ways to do this?

Closes #840
Co-authored-by: yendreij <yendreij@gmail.com>
@JRasmusBm
Copy link
Contributor Author

Force push: rebase to keep this branch up to date with master until a decision has been made.

@Conni2461
Copy link
Member

Conni2461 commented Jul 18, 2021

Yeah i dont wanna do this because i do not know if that has a negative effect down the line

Still thank you very much for looking into this issue. This will be very helpful in the future :)

@Conni2461 Conni2461 closed this Jul 18, 2021
@shivamchandra75
Copy link

shivamchandra75 commented Nov 17, 2023

I agree that adding a file type and advising users to disable FastFold for the file type is probably the best solution,

@JRasmusBm I don't understand what is fastFold and How to disable it.... I am on latest stable branch of telescope and this issue is from 2021 it should be solved by now. please help!!

FIXED: For me the plugin that was breaking the ascending sorter was "NvChad/nvim-colorizer.lua".

HOW TO FIX: set the filetypes to ignore these telescope buffers

require("colorizer").setup({
  filetypes = {
    "*",
    "!TelescopeResults",
    "!TelescopePrompt",
 },
})

@jamestrew
Copy link
Contributor

@shivamchandra75
Looks like FastFold is a vim plugin.

This supposedly can't be reproduced with telescope alone so you must have some configuration or plugin interfering with telescope behavior.

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.

Setting sorting to ascending with the previewer causes selection caret to disappear
6 participants