From 9b9c74373dc12a8872f46c44366dda9fc49ba5ba Mon Sep 17 00:00:00 2001 From: delphinus Date: Sat, 30 Nov 2024 19:45:52 +0900 Subject: [PATCH] fix: work with older version of Neovim --- lua/ale/diagnostics.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/ale/diagnostics.lua b/lua/ale/diagnostics.lua index 93f9485937..baec4e0add 100644 --- a/lua/ale/diagnostics.lua +++ b/lua/ale/diagnostics.lua @@ -68,7 +68,13 @@ module.sendAleResultsToDiagnostics = function(buffer, loclist) if set_signs == 1 and sign_priority then -- If signs are enabled, set the priority for them. local local_cfg = { priority = sign_priority } - local global_cfg = vim.diagnostic.config().signs + -- NOTE: vim.diagnostic.config() -- retrieving the current config values + -- fails in Neovim older than v0.7.0. + local ok, diag_cfg = pcall(vim.diagnostic.config) + if not ok or not diag_cfg then + diag_cfg = { signs = {} } + end + local global_cfg = diag_cfg.signs if type(global_cfg) == 'boolean' then signs = local_cfg