refactor(conflict): keep default virtual text labels minimal
Problem: default labels included keymap hints ("current — doo") which
is an anti-pattern for a vim plugin — discoverability belongs in docs
and opt-in config, not baked into the default UI.
Solution: default labels return to plain "(current)" / "(incoming)".
Keymap hints are only shown when users provide a format_virtual_text
function or enable show_actions.
This commit is contained in:
parent
c9e2722d19
commit
861f83600a
3 changed files with 7 additions and 41 deletions
|
|
@ -692,7 +692,7 @@ describe('conflict', function()
|
|||
conflict.detach(vim.api.nvim_get_current_buf())
|
||||
end)
|
||||
|
||||
it('includes keymap hints in default virtual text', function()
|
||||
it('default labels show current and incoming without keymaps', function()
|
||||
local bufnr = create_file_buffer({
|
||||
'<<<<<<< HEAD',
|
||||
'local x = 1',
|
||||
|
|
@ -703,33 +703,6 @@ describe('conflict', function()
|
|||
|
||||
conflict.attach(bufnr, default_config())
|
||||
|
||||
local extmarks = get_extmarks(bufnr)
|
||||
local labels = {}
|
||||
for _, mark in ipairs(extmarks) do
|
||||
if mark[4] and mark[4].virt_text then
|
||||
table.insert(labels, mark[4].virt_text[1][1])
|
||||
end
|
||||
end
|
||||
assert.are.equal(2, #labels)
|
||||
assert.is_truthy(labels[1]:find('current'))
|
||||
assert.is_truthy(labels[1]:find('doo'))
|
||||
assert.is_truthy(labels[2]:find('incoming'))
|
||||
assert.is_truthy(labels[2]:find('dot'))
|
||||
|
||||
helpers.delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('omits keymap from label when keymap is false', function()
|
||||
local bufnr = create_file_buffer({
|
||||
'<<<<<<< HEAD',
|
||||
'local x = 1',
|
||||
'=======',
|
||||
'local x = 2',
|
||||
'>>>>>>> feature',
|
||||
})
|
||||
|
||||
conflict.attach(bufnr, default_config({ keymaps = { ours = false, theirs = false } }))
|
||||
|
||||
local extmarks = get_extmarks(bufnr)
|
||||
local labels = {}
|
||||
for _, mark in ipairs(extmarks) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue