Skip to content

Commit

Permalink
refactor: vim.tbl_map() -> vim.iter().map().totable()
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Oct 25, 2024
1 parent 12f9470 commit d3ee825
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/cmp/config/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3ee825

Please sign in to comment.