Skip to content

Commit

Permalink
Add visual end location utility function
Browse files Browse the repository at this point in the history
Closes #44
  • Loading branch information
JoosepAlviste committed Aug 7, 2022
1 parent 7d0b001 commit d963994
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lua/ts_context_commentstring/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function M.get_cursor_line_non_whitespace_col_location()
}
end

---Get the location of the visual section start.
---Get the location of the visual selection start.
---
---@return ts_context_commentstring.Location
function M.get_visual_start_location()
Expand All @@ -87,6 +87,16 @@ function M.get_visual_start_location()
}
end

---Get the location of the visual selection end.
---
---@return ts_context_commentstring.Location
function M.get_visual_end_location()
return {
vim.fn.getpos("'>")[2] - 1,
vim.fn.getpos("'>")[3] - 1,
}
end

---Get the node that is on the given location (default first non-whitespace
---character of the cursor line). This also handles injected languages via
---language tree.
Expand Down

0 comments on commit d963994

Please sign in to comment.