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: always use pcall to check for treesitter parser #3313

Closed

Conversation

ChristianHeinigk
Copy link

@ChristianHeinigk ChristianHeinigk commented Oct 2, 2024

Description

When previewing a file, which does not have a treesitter parser, on nvim v0.11 an error is thrown. This change always uses pcall to try to add the treesitter parser for the detected filetype. Hence, the success and a message is returned and the previewer can gracefully just display the file's contents without highlighting.

Fixes #3314

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration

  • Preview any file for which no treesitter parser exist. I have specifically called into require"telescope.builtin".find_files{}

Configuration:

  • Neovim version (nvim --version):
NVIM v0.11.0-dev-616+gfd65422b9
Build type: RelWithDebInfo
LuaJIT 2.1.1723675123
Run "nvim -V1 -v" for more info
  • Operating system and version:
  • OS Name: Microsoft Windows 11 Enterprise
  • Version: 10.0.22631 Build 22631

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@ChristianHeinigk ChristianHeinigk marked this pull request as draft October 2, 2024 11:54
@ChristianHeinigk ChristianHeinigk marked this pull request as ready for review October 2, 2024 12:54
@jamestrew jamestrew requested a review from clason October 2, 2024 15:38
@clason
Copy link
Contributor

clason commented Oct 2, 2024

This is already fixed on master. Please make sure you have updated telescope. And your change actually removes that fix.

@clason clason closed this Oct 2, 2024
@clason
Copy link
Contributor

clason commented Oct 2, 2024

NVIM v0.11.0-dev-616+gfd65422b9

That is a way too old commit. If you insist on using master, you have to keep updating to the latest commit.

@ChristianHeinigk
Copy link
Author

Thanks for your quick reply! I can confirm it works with the latest nightly of neovim. For some reason, my update routine missed the neovim upgrade for some while...

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.

Previewer errors out when there is no treesitter parser for the detected filetype
2 participants