feat: use nvim_buf_set_extmark for vim.highlight (#16963)

Closes https://github.com/neovim/neovim/issues/13647

This allows customizing the priority of the highlights.

* Add default priority of 50
* Use priority of 200 for highlight on yank
* use priority of 40 for highlight references (LSP)
This commit is contained in:
Michael Lingelbach
2022-01-15 14:19:20 -08:00
committed by GitHub
parent f3193c7b54
commit b455e0179b
3 changed files with 32 additions and 16 deletions

View File

@@ -208,10 +208,10 @@ describe('vim.diagnostic', function()
eq(all_highlights, exec_lua [[
local ns_1_diags = {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 2, 1, 2, 5),
make_warning("Warning on Server 1", 2, 1, 2, 3),
}
local ns_2_diags = {
make_warning("Warning 1", 2, 1, 2, 5),
make_warning("Warning 1", 2, 1, 2, 3),
}
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, ns_1_diags)
@@ -255,10 +255,10 @@ describe('vim.diagnostic', function()
eq({0, 2}, exec_lua [[
local ns_1_diags = {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 2, 1, 2, 5),
make_warning("Warning on Server 1", 2, 1, 2, 3),
}
local ns_2_diags = {
make_warning("Warning 1", 2, 1, 2, 5),
make_warning("Warning 1", 2, 1, 2, 3),
}
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, ns_1_diags)
@@ -599,10 +599,10 @@ describe('vim.diagnostic', function()
eq(all_highlights, exec_lua [[
local ns_1_diags = {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 2, 1, 2, 5),
make_warning("Warning on Server 1", 2, 1, 2, 3),
}
local ns_2_diags = {
make_warning("Warning 1", 2, 1, 2, 5),
make_warning("Warning 1", 2, 1, 2, 3),
}
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, ns_1_diags)
@@ -787,7 +787,7 @@ describe('vim.diagnostic', function()
eq(2, exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 1, 1, 2, 5),
make_warning("Warning on Server 1", 1, 1, 2, 3),
})
return #vim.diagnostic.get(diagnostic_bufnr)
@@ -798,9 +798,9 @@ describe('vim.diagnostic', function()
eq({2, 3, 2}, exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 1, 1, 2, 5),
make_info("Ignored information", 1, 1, 2, 5),
make_hint("Here's a hint", 1, 1, 2, 5),
make_warning("Warning on Server 1", 1, 1, 2, 3),
make_info("Ignored information", 1, 1, 2, 3),
make_hint("Here's a hint", 1, 1, 2, 3),
})
return {
@@ -820,8 +820,8 @@ describe('vim.diagnostic', function()
eq(1, exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 1, 1, 2, 5),
make_info("Ignored information", 1, 1, 2, 5),
make_warning("Warning on Server 1", 1, 1, 2, 3),
make_info("Ignored information", 1, 1, 2, 3),
make_error("Error On Other Line", 2, 1, 1, 5),
})