Skip to content

Commit

Permalink
Fix treesitter based uncomment action doesn't work if has('nvim-0.8.0…
Browse files Browse the repository at this point in the history
…') && !has('nvim-0.9.0')
  • Loading branch information
ogaken-1 committed Jan 26, 2023
1 parent 575a060 commit 30256a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/caw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ function M.has_syntax(lnum, col)
end
end
elseif vim.fn.has("nvim-0.8.0") == 1 and vim.fn.has("nvim-0.9.0") == 0 then
-- TODO: Implement
-- vim.treesitter.get_captures_at_pos using 0-based coordinate
local captures = vim.treesitter.get_captures_at_pos(bufnr, lnum - 1, col - 1)
for _, capture in ipairs(captures) do
if capture.capture == "comment" then
return true
end
end
elseif vim.fn.has("nvim-0.9.0") == 1 then
-- vim.inspect_pos using 0-based coordinate
local items = vim.inspect_pos(bufnr, lnum - 1, col - 1)
Expand Down

0 comments on commit 30256a2

Please sign in to comment.