Skip to content

Commit

Permalink
Merge pull request #54 from JoosepAlviste/fix-comment-nvim-multiline-…
Browse files Browse the repository at this point in the history
…calculation
  • Loading branch information
JoosepAlviste authored Dec 30, 2022
2 parents 32d9627 + b17ed71 commit 4a42b30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/ts_context_commentstring/integrations/comment_nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ function M.create_pre_hook()
-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == U.ctype.blockwise then
location = require('ts_context_commentstring.utils').get_cursor_location()
location = {
ctx.range.srow - 1,
ctx.range.scol,
}
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require('ts_context_commentstring.utils').get_visual_start_location()
end
Expand Down
2 changes: 2 additions & 0 deletions lua/ts_context_commentstring/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ local fn = vim.fn

local parsers = require 'nvim-treesitter.parsers'

---Coordinates for a location. Both the line and the column are 0-indexed (e.g.,
---line nr 10 is line 9, the first column is 0).
---@alias ts_context_commentstring.Location number[] 2-tuple of (line, column)

local M = {}
Expand Down

0 comments on commit 4a42b30

Please # to comment.