nvim-treesitter / nvim-treesitter-refactor

Refactor module for nvim-treesitter
Apache License 2.0
407 stars 25 forks source link

How to disable on large buffer? #50

Closed towry closed 1 year ago

towry commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

towry commented 1 year ago
local disabled = function(lang, bufnr)
  --- logic to check to disable on this bufnr.
end
          highlight_definitions = {
            is_supported = function(lang)
              local queries = require("nvim-treesitter.query")
              return not disabled(lang, vim.api.nvim_get_current_buf()) and queries.has_locals(lang)
            end,
          }