aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/nvim-treesitter.txt4
-rw-r--r--lua/nvim-treesitter/statusline.lua7
2 files changed, 4 insertions, 7 deletions
diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt
index f8ac369bd..884f334eb 100644
--- a/doc/nvim-treesitter.txt
+++ b/doc/nvim-treesitter.txt
@@ -447,7 +447,7 @@ Default options (lua syntax):
type_patterns = {'class', 'function', 'method'},
transform_fn = function(line, _node) return line:gsub('%s*[%[%(%{]*%s*$', '') end,
separator = ' -> ',
- dedupe = true
+ allow_duplicates = false
}
<
- `indicator_size` - How long should the string be. If longer, it is cut from
@@ -457,7 +457,7 @@ Default options (lua syntax):
default removes opening brackets and spaces from end. Takes two arguments:
the text of the line in question, and the corresponding treesitter node.
- `separator` - Separator between nodes.
-- `dedupe` - Whether or not to remove duplicate components.
+- `allow_duplicates` - Whether or not to remove duplicate components.
*nvim_treesitter#foldexpr()*
nvim_treesitter#foldexpr()~
diff --git a/lua/nvim-treesitter/statusline.lua b/lua/nvim-treesitter/statusline.lua
index fde7def2b..68ba41aca 100644
--- a/lua/nvim-treesitter/statusline.lua
+++ b/lua/nvim-treesitter/statusline.lua
@@ -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