diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-12-03 14:46:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-03 14:46:53 +0100 |
| commit | 60a4ce080fe7d3e57df209f1ad911bd0bff4ea43 (patch) | |
| tree | 896f58cd002a0075aaa04cb7d21c7cb7ef50928c /lua/telescope/builtin/files.lua | |
| parent | 4e075bf924dcd1127380a00b38a8fb567749f72a (diff) | |
fix: dont change highlights when using current_buffer_fuzzy_find (#1524)
this happens if parsers are installed but highlight is set to false.
So parsing the buffer with treesitter will automatically apply them to
the buffer but because treesitter highlighting is disabled it will
change the buffer. Its stupid and i dont know why you want parser
installed but highlighting disabled but whatever.
We just dont calculate highlights for people who have highlight set
to false
Diffstat (limited to 'lua/telescope/builtin/files.lua')
| -rw-r--r-- | lua/telescope/builtin/files.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 096820a..c726f98 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -487,10 +487,11 @@ files.current_buffer_fuzzy_find = function(opts) if ts_ok then filetype = ts_parsers.ft_to_lang(filetype) end + local _, ts_configs = pcall(require, "nvim-treesitter.configs") local parser_ok, parser = pcall(vim.treesitter.get_parser, bufnr, filetype) local query_ok, query = pcall(vim.treesitter.get_query, filetype, "highlights") - if parser_ok and query_ok then + if ts_configs.is_enabled("highlight", filetype, bufnr) and parser_ok and query_ok then local root = parser:parse()[1]:root() local highlighter = vim.treesitter.highlighter.new(parser) |
