feat: add some config options

This commit is contained in:
Barrett Ruth 2026-02-01 18:52:00 -05:00
parent ae727159b9
commit 0e86f45c39
3 changed files with 42 additions and 2 deletions

View file

@ -10,13 +10,27 @@ end
---@param bufnr integer
---@param ns integer
---@param hunk fugitive-ts.Hunk
---@param max_lines integer
---@param debug? boolean
function M.highlight_hunk(bufnr, ns, hunk, debug)
function M.highlight_hunk(bufnr, ns, hunk, max_lines, debug)
local lang = hunk.lang
if not lang then
return
end
if #hunk.lines > max_lines then
if debug then
dbg(
'skipping hunk %s:%d (%d lines > %d max)',
hunk.filename,
hunk.start_line,
#hunk.lines,
max_lines
)
end
return
end
---@type string[]
local code_lines = {}
for _, line in ipairs(hunk.lines) do
@ -52,6 +66,18 @@ function M.highlight_hunk(bufnr, ns, hunk, debug)
return
end
for i, line in ipairs(hunk.lines) do
local buf_line = hunk.start_line + i - 1
local line_len = #line
if line_len > 1 then
pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, 1, {
end_col = line_len,
hl_group = 'Normal',
priority = 199,
})
end
end
local extmark_count = 0
for id, node, _ in query:iter_captures(trees[1]:root(), code) do
local capture_name = '@' .. query.captures[id]