diff options
Diffstat (limited to 'lua/nvim-treesitter.lua')
| -rw-r--r-- | lua/nvim-treesitter.lua | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/lua/nvim-treesitter.lua b/lua/nvim-treesitter.lua index 0165b5383..efdf21e98 100644 --- a/lua/nvim-treesitter.lua +++ b/lua/nvim-treesitter.lua @@ -3,7 +3,6 @@ local utils = require "nvim-treesitter.utils" local info = require "nvim-treesitter.info" local configs = require "nvim-treesitter.configs" local parsers = require "nvim-treesitter.parsers" -local ts_query = vim.treesitter.query local ts_utils = require "nvim-treesitter.ts_utils" -- Registers all query predicates @@ -22,23 +21,6 @@ function M.define_modules(...) configs.define_modules(...) end -local get_line_for_node = function(node, type_patterns, transform_fn, bufnr) - local node_type = node:type() - local is_valid = false - for _, rgx in ipairs(type_patterns) do - if node_type:find(rgx) then - is_valid = true - break - end - end - if not is_valid then - return "" - end - local line = transform_fn(vim.trim(ts_query.get_node_text(node, bufnr) or "")) - -- Escape % to avoid statusline to evaluate content as expression - return line:gsub("%%", "%%%%") -end - -- Trim spaces and opening brackets from end local transform_line = function(line) return line:gsub("%s*[%[%(%{]*%s*$", "") @@ -67,7 +49,7 @@ function M.statusline(opts) local expr = current_node while expr do - local line = get_line_for_node(expr, type_patterns, transform_fn, bufnr) + local line = ts_utils._get_line_for_node(expr, type_patterns, transform_fn, bufnr) if line ~= "" and not vim.tbl_contains(lines, line) then table.insert(lines, 1, line) end |
