fix(highlight): add create param in nvim_get_hl

This commit is contained in:
glepnir
2023-09-07 18:42:38 +08:00
parent 82150ca51b
commit 8afb3a49c0
7 changed files with 23 additions and 1 deletions

View File

@@ -439,6 +439,15 @@ describe('API: get highlight', function()
eq('Highlight id out of bounds', pcall_err(meths.get_hl, 0, { name = 'Test set hl' }))
end)
it('nvim_get_hl with create flag', function()
eq({}, nvim("get_hl", 0, {name = 'Foo', create = false}))
eq(0, funcs.hlexists('Foo'))
meths.get_hl(0, {name = 'Bar', create = true})
eq(1, funcs.hlexists('Bar'))
meths.get_hl(0, {name = 'FooBar'})
eq(1, funcs.hlexists('FooBar'))
end)
it('can get all highlights in current namespace', function()
local ns = get_ns()
meths.set_hl(ns, 'Test_hl', { bg = '#B4BEFE' })