Skip to content

fix: fallback to filetype for get_lang for treesitter highlight preview#2867

Merged
Conni2461 merged 1 commit into
nvim-telescope:masterfrom
seblyng:treesitter-highlight-fix
Jan 18, 2024
Merged

fix: fallback to filetype for get_lang for treesitter highlight preview#2867
Conni2461 merged 1 commit into
nvim-telescope:masterfrom
seblyng:treesitter-highlight-fix

Conversation

@seblyng

@seblyng seblyng commented Jan 13, 2024

Copy link
Copy Markdown
Contributor

Description

nvim-treesitter is in the middle of a rewrite, and will switch to the rewrite once Neovim 0.10 is released. In this rewrite, there is something that has changed with registering a language. This introduces an issue in telescope, where it is not always able to provide treesitter highlighting in the preview.

Reading the code in nvim-treesitter, it also uses vim.treesitter.language.get_lang and always fallback to the filetype if the function doesn't provide any language

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

Install the newest nvim-treesitter using the main branch. Try to open a picker with a previewer, and notice that some languages where the filetype name matches the parser name, and see that it is not properly highlighted.

Configuration:

  • Neovim version (nvim --version): NVIM v0.10.0-dev-2076+g2dc439c67
  • Operating system and version: macOS Sonoma 14.2.1

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)

@seblyng seblyng changed the title fix: properly get lang for treesitter highlight preview fix: fallback to filetype for get lang for treesitter highlight preview Jan 13, 2024
@seblyng seblyng changed the title fix: fallback to filetype for get lang for treesitter highlight preview fix: fallback to filetype for get_lang for treesitter highlight preview Jan 13, 2024
@Conni2461

Copy link
Copy Markdown
Member

thanks :)

@Conni2461
Conni2461 merged commit b4befa1 into nvim-telescope:master Jan 18, 2024
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