From d3ee82553255fa9c6284fd58f1d66581c621d098 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 25 Oct 2024 22:45:38 +0400 Subject: [PATCH] refactor: vim.tbl_map() -> vim.iter().map().totable() --- lua/cmp/config/context.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/cmp/config/context.lua b/lua/cmp/config/context.lua index e09b2bd..33adf12 100644 --- a/lua/cmp/config/context.lua +++ b/lua/cmp/config/context.lua @@ -40,9 +40,9 @@ context.in_treesitter_capture = function(capture) local get_captures_at_pos = -- See neovim/neovim#20331 require('vim.treesitter').get_captures_at_pos -- for neovim >= 0.8 or require('vim.treesitter').get_captures_at_position -- for neovim < 0.8 - local captures_at_cursor = vim.tbl_map(function(x) + local captures_at_cursor = vim.iter(get_captures_at_pos(buf, row, col)):map(function (x) return x.capture - end, get_captures_at_pos(buf, row, col)) + end):totable() if vim.tbl_isempty(captures_at_cursor) then return false