ci: formatting
This commit is contained in:
parent
13c0ea1e92
commit
e5d9b4b7bd
9 changed files with 44 additions and 18 deletions
|
|
@ -2,7 +2,12 @@
|
|||
"runtime.version": "LuaJIT",
|
||||
"runtime.path": ["lua/?.lua", "lua/?/init.lua"],
|
||||
"diagnostics.globals": ["vim", "jit"],
|
||||
"workspace.library": ["$VIMRUNTIME/lua", "${3rd}/luv/library", "${3rd}/busted/library", "${3rd}/luassert/library"],
|
||||
"workspace.library": [
|
||||
"$VIMRUNTIME/lua",
|
||||
"${3rd}/luv/library",
|
||||
"${3rd}/busted/library",
|
||||
"${3rd}/luassert/library"
|
||||
],
|
||||
"workspace.checkThirdParty": false,
|
||||
"workspace.ignoreDir": [".direnv"],
|
||||
"completion.callSnippet": "Replace"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ with language-aware syntax highlighting.
|
|||
- `:Gdiff` unified diff against any revision
|
||||
- Background-only diff colors for `&diff` buffers
|
||||
- Inline merge conflict detection, highlighting, and resolution
|
||||
- Email-quoted diff highlighting (`> diff ...` prefixes, arbitrary nesting depth)
|
||||
- Email-quoted diff highlighting (`> diff ...` prefixes, arbitrary nesting
|
||||
depth)
|
||||
- Vim syntax fallback, configurable blend/priorities
|
||||
|
||||
## Requirements
|
||||
|
|
|
|||
|
|
@ -522,11 +522,12 @@ function M.highlight_hunk(bufnr, ns, hunk, opts)
|
|||
char_hl,
|
||||
line:sub(span.col_start + 1, span.col_end)
|
||||
)
|
||||
local ok, err = pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, span.col_start + qw, {
|
||||
end_col = span.col_end + qw,
|
||||
hl_group = char_hl,
|
||||
priority = p.char_bg,
|
||||
})
|
||||
local ok, err =
|
||||
pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, span.col_start + qw, {
|
||||
end_col = span.col_end + qw,
|
||||
hl_group = char_hl,
|
||||
priority = p.char_bg,
|
||||
})
|
||||
if not ok then
|
||||
dbg('char extmark FAILED: %s', err)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -789,7 +789,11 @@ local function init()
|
|||
end
|
||||
local cur = hunk_cache[bufnr]
|
||||
if not cur or cur.tick ~= tick then
|
||||
dbg('deferred syntax stale: cur.tick=%s captured=%d', cur and tostring(cur.tick) or 'nil', tick)
|
||||
dbg(
|
||||
'deferred syntax stale: cur.tick=%s captured=%d',
|
||||
cur and tostring(cur.tick) or 'nil',
|
||||
tick
|
||||
)
|
||||
return
|
||||
end
|
||||
local t1 = config.debug and vim.uv.hrtime() or nil
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ local function get_ft_from_filename(filename, repo_root)
|
|||
if not ft and vim.fn.did_filetype() ~= 0 then
|
||||
dbg('retrying filetype match for %s (clearing did_filetype)', filename)
|
||||
local saved = rawget(vim.fn, 'did_filetype')
|
||||
rawset(vim.fn, 'did_filetype', function() return 0 end)
|
||||
rawset(vim.fn, 'did_filetype', function()
|
||||
return 0
|
||||
end)
|
||||
ft = vim.filetype.match({ filename = filename })
|
||||
rawset(vim.fn, 'did_filetype', saved)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require('spec.helpers')
|
||||
local parser = require('diffs.parser')
|
||||
local highlight = require('diffs.highlight')
|
||||
local parser = require('diffs.parser')
|
||||
|
||||
local function create_buffer(lines)
|
||||
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||
|
|
@ -34,7 +34,6 @@ local function highlight_opts()
|
|||
end
|
||||
|
||||
describe('parser email-quoted diffs', function()
|
||||
|
||||
it('parses a fully email-quoted unified diff', function()
|
||||
local bufnr = create_buffer({
|
||||
'> diff --git a/foo.py b/foo.py',
|
||||
|
|
|
|||
|
|
@ -419,8 +419,13 @@ describe('highlight', function()
|
|||
local last_body_row = hunk.start_line + #hunk.lines - 1
|
||||
vim.api.nvim_buf_clear_namespace(bufnr, ns, last_body_row + 1, last_body_row + 10)
|
||||
|
||||
local marks =
|
||||
vim.api.nvim_buf_get_extmarks(bufnr, ns, { last_body_row, 0 }, { last_body_row, -1 }, { details = true })
|
||||
local marks = vim.api.nvim_buf_get_extmarks(
|
||||
bufnr,
|
||||
ns,
|
||||
{ last_body_row, 0 },
|
||||
{ last_body_row, -1 },
|
||||
{ details = true }
|
||||
)
|
||||
local has_line_bg = false
|
||||
for _, mark in ipairs(marks) do
|
||||
if mark[4] and mark[4].line_hl_group == 'DiffsAdd' then
|
||||
|
|
@ -464,8 +469,13 @@ describe('highlight', function()
|
|||
local clear_end = hunk.start_line + #hunk.lines
|
||||
vim.api.nvim_buf_clear_namespace(bufnr, ns, clear_start, clear_end)
|
||||
|
||||
local marks =
|
||||
vim.api.nvim_buf_get_extmarks(bufnr, ns, { last_body_row, 0 }, { last_body_row, -1 }, { details = false })
|
||||
local marks = vim.api.nvim_buf_get_extmarks(
|
||||
bufnr,
|
||||
ns,
|
||||
{ last_body_row, 0 },
|
||||
{ last_body_row, -1 },
|
||||
{ details = false }
|
||||
)
|
||||
assert.are.equal(0, #marks)
|
||||
delete_buffer(bufnr)
|
||||
end)
|
||||
|
|
@ -849,7 +859,7 @@ describe('highlight', function()
|
|||
if d then
|
||||
if d.hl_group == 'DiffsClear' then
|
||||
table.insert(priorities.clear, d.priority)
|
||||
elseif (d.line_hl_group == 'DiffsAdd' or d.line_hl_group == 'DiffsDelete') then
|
||||
elseif d.line_hl_group == 'DiffsAdd' or d.line_hl_group == 'DiffsDelete' then
|
||||
table.insert(priorities.line_bg, d.priority)
|
||||
elseif d.hl_group == 'DiffsAddText' or d.hl_group == 'DiffsDeleteText' then
|
||||
table.insert(priorities.char_bg, d.priority)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,9 @@ describe('integration', function()
|
|||
|
||||
describe('ft_retry_pending', function()
|
||||
before_each(function()
|
||||
rawset(vim.fn, 'did_filetype', function() return 1 end)
|
||||
rawset(vim.fn, 'did_filetype', function()
|
||||
return 1
|
||||
end)
|
||||
require('diffs.parser')._test.ft_lang_cache = {}
|
||||
end)
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,9 @@ describe('parser', function()
|
|||
end)
|
||||
|
||||
it('detects filetype for .sh files when did_filetype() is non-zero', function()
|
||||
rawset(vim.fn, 'did_filetype', function() return 1 end)
|
||||
rawset(vim.fn, 'did_filetype', function()
|
||||
return 1
|
||||
end)
|
||||
|
||||
parser._test.ft_lang_cache = {}
|
||||
local bufnr = create_buffer({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue