fdschmidt93 / telescope-egrepify.nvim

Variable user customization for telescope.live_grep to set rg flags on-the-fly
MIT License
123 stars 13 forks source link

feat(entry_maker): make ts highlighting default #49

Closed fdschmidt93 closed 1 month ago

fdschmidt93 commented 1 month ago

@delphinus thoughts? I think nvim ts performance improved significantly and I don't experience freezes or noticeable slowdowns with this option. And it's too much of a QoL improvement. Agreed?

delphinus commented 1 month ago

Agree.

But I wonder what happens in starting egrepify without Tree-sitter setup (like nvim --clean). Does it work good in such case? If no, it is good that README has notice for it.

fdschmidt93 commented 1 month ago
local function has_ts_parser(lang)
  if vim.fn.has "nvim-0.11" == 1 then
    return vim.treesitter.language.add(lang)
  else
    return pcall(vim.treesitter.language.add, lang)
  end
end

The above function only returns a parser (i.e., ultimately highlights) if the corresponding language of the file is supported by having a suitable parser in the nvim runtime. In other words, I'm reasonably sure it should be fine.

Thanks for the feedback!