-
-
Notifications
You must be signed in to change notification settings - Fork 804
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
Disable highlight in preview base on a config array of function #3150
Comments
You don't have a tree-sitter parser for latex or you have it but have the tree-sitter highlighting disabled? I can't reproduce this with your provided instructions. Please edit the minimal config in the bug report to add the minimum number of changes needed to reproduce this error. |
I also had this issue. I might be able to construct a minimal config etc. on the weekend, but for now: It appears that this happens if a TS parser is installed with highlighting is disabled, like this:
There are usecases for this when you want to use external syntax highlighting and plugins relying on tree-sitter. For now my workaround is uninstalling the |
Thanks for the additional info. Here's a minimal config I tried: local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "latex" },
highlight = {
enable = true,
disable = { "latex" },
},
})
end,
},
-- seeing if this makes a difference
{
"lervag/vimtex",
lazy = false,
enabled = false,
},
{ "folke/tokyonight.nvim" }, -- just so I can tell highlighting is on/off
{
"nvim-telescope/telescope.nvim",
tag = "0.1.7",
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = {},
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight") Still not able to reproduce. |
You can disable highlighting for specific languages within telescope. Checkout |
I can confirm that this is working. The relevant part of opts is defaults = {
preview = {
treesitter = {
enable = true,
disable = { 'tex' }, -- NOTE: https://github.com/nvim-telescope/telescope.nvim/issues/3150 <17-06-24>
},
} |
What however does not work is require('telescope.builtin').current_buffer_fuzzy_find where you could only disable highlighting globally. function()
require('telescope.builtin').current_buffer_fuzzy_find { results_ts_highlight = vim.o.filetype ~= 'tex' }
end, |
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.
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
Operating system and version
ubuntu 22.04
Telescope version / branch / rev
telescope 0.1.7
checkhealth telescope
Steps to reproduce
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
The text was updated successfully, but these errors were encountered: