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