telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

Disable highlight in preview base on a config array of function

Open Fildo7525 opened this issue 8 months ago • 6 comments

Description

If you do not have a treesitter for a specific filetype for me it's latex you get errors every time your cursor is on a filetype. The filetype is disabled in treesitter.

Error in decoration provider treesitter/highlighter.win:
Error executing lua: ...-linux64/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 74:3. Impossible pattern:
  name: (curly_group_text_list
  ^

stack traceback:
        [C]: in function '_ts_parse_query'
        ...-linux64/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn'
        ...vim-linux64/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn'
        ...vim-linux64/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'get'
        ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:28: in function 'new'
        ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:240: in function 'get_query'
        ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:188: in function 'fn'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:473: in function 'for_each_tree'
        ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:175: in function 'prepare_highlight_states'
        ...64/share/nvim/runtime/lua/vim/treesitter/hig

It's extremely annoying. It would be great to have a filed in the config that accepts either table or function that determines if the filetype should use treesitter in the preview or not.

Neovim version

NVIM v0.11.0-dev-67+g0e9c92a90
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068

Operating system and version

ubuntu 22.04

Telescope version / branch / rev

telescope 0.1.7

checkhealth telescope

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.3.1

===== Installed extensions ===== ~

Telescope Extension: `clang_reloader` ~
- No healthcheck provided

Telescope Extension: `projects` ~
- No healthcheck provided

Steps to reproduce

  1. open project with files that you do not have treesitter on
  2. file_file with preview
  3. scroll the files and find the file in the telescope.

Expected behavior

The treesitter will not be applied

Actual behavior

Even thou I have in my treesitter config latex disabled I still get errors for the treesitter, that it could not parse the preview

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('fzf')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

Fildo7525 avatar Jun 01 '24 12:06 Fildo7525