mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-08 06:20:01 -04:00
use positive option "allow_duplicates" instead of negative "dedupe"
This commit is contained in:
parent
3fab7abf6f
commit
20a8f30ace
2 changed files with 4 additions and 7 deletions
|
|
@ -21,10 +21,7 @@ function M.statusline(opts)
|
|||
local type_patterns = options.type_patterns or { "class", "function", "method" }
|
||||
local transform_fn = options.transform_fn or transform_line
|
||||
local separator = options.separator or " -> "
|
||||
local dedupe = options.dedupe
|
||||
if dedupe == nil then
|
||||
dedupe = true
|
||||
end
|
||||
local allow_duplicates = options.allow_duplicates or false
|
||||
|
||||
local current_node = ts_utils.get_node_at_cursor()
|
||||
if not current_node then
|
||||
|
|
@ -37,7 +34,7 @@ function M.statusline(opts)
|
|||
while expr do
|
||||
local line = ts_utils._get_line_for_node(expr, type_patterns, transform_fn, bufnr)
|
||||
if line ~= "" then
|
||||
if not dedupe or not vim.tbl_contains(lines, line) then
|
||||
if allow_duplicates or not vim.tbl_contains(lines, line) then
|
||||
table.insert(lines, 1, line)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue