From e5d9b4b7bd034abaa5bdbadd9a38c33ebe840657 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 4 Mar 2026 17:32:55 -0500 Subject: [PATCH] ci: formatting --- .luarc.json | 7 ++++++- README.md | 3 ++- lua/diffs/highlight.lua | 11 ++++++----- lua/diffs/init.lua | 6 +++++- lua/diffs/parser.lua | 4 +++- spec/email_quote_spec.lua | 3 +-- spec/highlight_spec.lua | 20 +++++++++++++++----- spec/integration_spec.lua | 4 +++- spec/parser_spec.lua | 4 +++- 9 files changed, 44 insertions(+), 18 deletions(-) diff --git a/.luarc.json b/.luarc.json index eb18f65..3f6276a 100644 --- a/.luarc.json +++ b/.luarc.json @@ -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" diff --git a/README.md b/README.md index 80fa968..eee728d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lua/diffs/highlight.lua b/lua/diffs/highlight.lua index 541e6f9..98943d2 100644 --- a/lua/diffs/highlight.lua +++ b/lua/diffs/highlight.lua @@ -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 diff --git a/lua/diffs/init.lua b/lua/diffs/init.lua index e8d1f0d..6af7e1a 100644 --- a/lua/diffs/init.lua +++ b/lua/diffs/init.lua @@ -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 diff --git a/lua/diffs/parser.lua b/lua/diffs/parser.lua index 4f657f3..4490c90 100644 --- a/lua/diffs/parser.lua +++ b/lua/diffs/parser.lua @@ -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 diff --git a/spec/email_quote_spec.lua b/spec/email_quote_spec.lua index fb445f6..3f2bd6e 100644 --- a/spec/email_quote_spec.lua +++ b/spec/email_quote_spec.lua @@ -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', diff --git a/spec/highlight_spec.lua b/spec/highlight_spec.lua index 2ba453f..ebd075f 100644 --- a/spec/highlight_spec.lua +++ b/spec/highlight_spec.lua @@ -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) diff --git a/spec/integration_spec.lua b/spec/integration_spec.lua index fe221c0..23e870b 100644 --- a/spec/integration_spec.lua +++ b/spec/integration_spec.lua @@ -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) diff --git a/spec/parser_spec.lua b/spec/parser_spec.lua index f084fbc..729ad16 100644 --- a/spec/parser_spec.lua +++ b/spec/parser_spec.lua @@ -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({