Skip to content

Commit

Permalink
fix: consider the original config for signs
Browse files Browse the repository at this point in the history
  • Loading branch information
delphinus committed Nov 28, 2024
1 parent 9d30fb2 commit a17b062
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions lua/ale/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,34 @@ module.sendAleResultsToDiagnostics = function(buffer, loclist)
[1] = true,
}

local signs = module.aleVar(buffer, 'set_signs') == 1
local set_signs = module.aleVar(buffer, 'set_signs')
local sign_priority = module.aleVar(buffer, 'sign_priority')
local signs

if signs then
if set_signs == 1 and sign_priority then
-- If signs are enabled, set the priority for them.
signs = {priority = vim.g.ale_sign_priority }
local local_cfg = { priority = sign_priority }
local global_cfg = vim.diagnostic.config().signs

if type(global_cfg) == 'boolean' then
signs = local_cfg
elseif type(global_cfg) == 'table' then
signs = vim.tbl_extend('force', global_cfg, local_cfg)
else
signs = function(...)
local calculated = global_cfg(...)
return vim.tbl_extend('force', calculated, local_cfg)
end
end
end

vim.diagnostic.set(
vim.api.nvim_create_namespace('ale'),
buffer,
diagnostics,
{
virtual_text = virtualtext_enabled_set[vim.g.ale_virtualtext_cursor] ~= nil,
signs = signs,
virtual_text = virtualtext_enabled_set[vim.g.ale_virtualtext_cursor] ~= nil,
signs = signs,
}
)
end
Expand Down

0 comments on commit a17b062

Please sign in to comment.