refactor(config): nest integration toggles under integrations namespace (#174)

## Problem

Integration keys (`fugitive`, `neogit`, `gitsigns`, `committia`,
`telescope`)
live at the top level of `vim.g.diffs`, cluttering the config namespace.

## Solution

Move them under `vim.g.diffs.integrations.*`. Old top-level keys still
work but
emit `vim.deprecate` targeting v0.3.2. `compute_filetypes` and
`plugin/diffs.lua`
fall back to legacy keys for pre-`init()` callers.

Also includes `83c17ac` which fixes an invalid hex hash in the combined
diff test
fixture.
This commit is contained in:
Barrett Ruth 2026-03-06 14:46:02 -05:00 committed by GitHub
parent 823743192a
commit a880261988
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 151 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()