refactor(config): nest integration toggles under integrations namespace

Problem: integration keys (`fugitive`, `neogit`, `gitsigns`, `committia`,
`telescope`) live at the top level of `vim.g.diffs`, cluttering the
config alongside unrelated options like `highlights` and `conflict`.

Solution: move them under `vim.g.diffs.integrations.*`. Old top-level
keys are migrated automatically with a `vim.deprecate` warning targeting
v0.3.2. `compute_filetypes` and `plugin/diffs.lua` fall back to legacy
keys for pre-`init()` callers.
This commit is contained in:
Barrett Ruth 2026-03-06 14:26:40 -05:00
parent 83c17aca67
commit 1b4d933148
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 129 additions and 67 deletions

View file

@ -336,45 +336,45 @@ describe('diffs', function()
assert.are.same({ 'git', 'gitcommit' }, fts)
end)
it('includes fugitive when fugitive = true', function()
local fts = compute({ fugitive = true })
it('includes fugitive when integrations.fugitive = true', function()
local fts = compute({ integrations = { fugitive = true } })
assert.is_true(vim.tbl_contains(fts, 'fugitive'))
end)
it('includes fugitive when fugitive is a table', function()
local fts = compute({ fugitive = { horizontal = 'dd' } })
it('includes fugitive when integrations.fugitive is a table', function()
local fts = compute({ integrations = { fugitive = { horizontal = 'dd' } } })
assert.is_true(vim.tbl_contains(fts, 'fugitive'))
end)
it('excludes fugitive when fugitive = false', function()
local fts = compute({ fugitive = false })
it('excludes fugitive when integrations.fugitive = false', function()
local fts = compute({ integrations = { fugitive = false } })
assert.is_false(vim.tbl_contains(fts, 'fugitive'))
end)
it('excludes fugitive when fugitive is nil', function()
local fts = compute({})
it('excludes fugitive when integrations.fugitive is nil', function()
local fts = compute({ integrations = {} })
assert.is_false(vim.tbl_contains(fts, 'fugitive'))
end)
it('includes neogit filetypes when neogit = true', function()
local fts = compute({ neogit = true })
it('includes neogit filetypes when integrations.neogit = true', function()
local fts = compute({ integrations = { neogit = true } })
assert.is_true(vim.tbl_contains(fts, 'NeogitStatus'))
assert.is_true(vim.tbl_contains(fts, 'NeogitCommitView'))
assert.is_true(vim.tbl_contains(fts, 'NeogitDiffView'))
end)
it('includes neogit filetypes when neogit is a table', function()
local fts = compute({ neogit = {} })
it('includes neogit filetypes when integrations.neogit is a table', function()
local fts = compute({ integrations = { neogit = {} } })
assert.is_true(vim.tbl_contains(fts, 'NeogitStatus'))
end)
it('excludes neogit when neogit = false', function()
local fts = compute({ neogit = false })
it('excludes neogit when integrations.neogit = false', function()
local fts = compute({ integrations = { neogit = false } })
assert.is_false(vim.tbl_contains(fts, 'NeogitStatus'))
end)
it('excludes neogit when neogit is nil', function()
local fts = compute({})
it('excludes neogit when integrations.neogit is nil', function()
local fts = compute({ integrations = {} })
assert.is_false(vim.tbl_contains(fts, 'NeogitStatus'))
end)
@ -383,13 +383,31 @@ describe('diffs', function()
assert.is_true(vim.tbl_contains(fts, 'diff'))
end)
it('combines fugitive, neogit, and extra_filetypes', function()
local fts = compute({ fugitive = true, neogit = true, extra_filetypes = { 'diff' } })
it('combines integrations and extra_filetypes', function()
local fts = compute({
integrations = { fugitive = true, neogit = true },
extra_filetypes = { 'diff' },
})
assert.is_true(vim.tbl_contains(fts, 'git'))
assert.is_true(vim.tbl_contains(fts, 'fugitive'))
assert.is_true(vim.tbl_contains(fts, 'NeogitStatus'))
assert.is_true(vim.tbl_contains(fts, 'diff'))
end)
it('falls back to legacy top-level fugitive key', function()
local fts = compute({ fugitive = true })
assert.is_true(vim.tbl_contains(fts, 'fugitive'))
end)
it('falls back to legacy top-level neogit key', function()
local fts = compute({ neogit = true })
assert.is_true(vim.tbl_contains(fts, 'NeogitStatus'))
end)
it('prefers integrations key over legacy top-level key', function()
local fts = compute({ integrations = { fugitive = false }, fugitive = true })
assert.is_false(vim.tbl_contains(fts, 'fugitive'))
end)
end)
describe('diff mode', function()