diff options
| author | Nat Williams <nat.williams@kin.com> | 2023-02-02 13:26:20 -0600 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2023-02-24 14:55:30 -0800 |
| commit | 20a8f30ace9fa9209b1c345311a36e91ab2f6d1d (patch) | |
| tree | 0a527157db71a174e9ea0531c24322b0b1d59ea4 /lua | |
| parent | add statusline option to dedupe or not (diff) | |
| download | nvim-treesitter-20a8f30ace9fa9209b1c345311a36e91ab2f6d1d.tar nvim-treesitter-20a8f30ace9fa9209b1c345311a36e91ab2f6d1d.tar.gz nvim-treesitter-20a8f30ace9fa9209b1c345311a36e91ab2f6d1d.tar.bz2 nvim-treesitter-20a8f30ace9fa9209b1c345311a36e91ab2f6d1d.tar.lz nvim-treesitter-20a8f30ace9fa9209b1c345311a36e91ab2f6d1d.tar.xz nvim-treesitter-20a8f30ace9fa9209b1c345311a36e91ab2f6d1d.tar.zst nvim-treesitter-20a8f30ace9fa9209b1c345311a36e91ab2f6d1d.zip | |
use positive option "allow_duplicates" instead of negative "dedupe"
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/statusline.lua | 7 |
1 files changed, 2 insertions, 5 deletions
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 |
