mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
lsp: use vim.tbl_isempty to check sign (#12190)
ref: #12164 fix #12201 sign_getdefined() returns a list, {} if the sign is not defined.
This commit is contained in:
@@ -1017,21 +1017,18 @@ function lsp.get_log_path()
|
|||||||
return log.get_filename()
|
return log.get_filename()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function define_default_sign(name, properties)
|
|
||||||
if not vim.fn.sign_getdefined(name) then
|
|
||||||
vim.fn.sign_define(name, properties)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Define the LspDiagnostics signs if they're not defined already.
|
-- Define the LspDiagnostics signs if they're not defined already.
|
||||||
local function define_default_lsp_diagnostics_signs()
|
do
|
||||||
|
local function define_default_sign(name, properties)
|
||||||
|
if vim.tbl_isempty(vim.fn.sign_getdefined(name)) then
|
||||||
|
vim.fn.sign_define(name, properties)
|
||||||
|
end
|
||||||
|
end
|
||||||
define_default_sign('LspDiagnosticsErrorSign', {text='E', texthl='LspDiagnosticsError', linehl='', numhl=''})
|
define_default_sign('LspDiagnosticsErrorSign', {text='E', texthl='LspDiagnosticsError', linehl='', numhl=''})
|
||||||
define_default_sign('LspDiagnosticsWarningSign', {text='W', texthl='LspDiagnosticsWarning', linehl='', numhl=''})
|
define_default_sign('LspDiagnosticsWarningSign', {text='W', texthl='LspDiagnosticsWarning', linehl='', numhl=''})
|
||||||
define_default_sign('LspDiagnosticsInformationSign', {text='I', texthl='LspDiagnosticsInformation', linehl='', numhl=''})
|
define_default_sign('LspDiagnosticsInformationSign', {text='I', texthl='LspDiagnosticsInformation', linehl='', numhl=''})
|
||||||
define_default_sign('LspDiagnosticsHintSign', {text='H', texthl='LspDiagnosticsHint', linehl='', numhl=''})
|
define_default_sign('LspDiagnosticsHintSign', {text='H', texthl='LspDiagnosticsHint', linehl='', numhl=''})
|
||||||
end
|
end
|
||||||
|
|
||||||
define_default_lsp_diagnostics_signs()
|
|
||||||
|
|
||||||
return lsp
|
return lsp
|
||||||
-- vim:sw=2 ts=2 et
|
-- vim:sw=2 ts=2 et
|
||||||
|
@@ -8489,6 +8489,7 @@ static void f_sign_define(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
xfree(linehl);
|
xfree(linehl);
|
||||||
xfree(text);
|
xfree(text);
|
||||||
xfree(texthl);
|
xfree(texthl);
|
||||||
|
xfree(numhl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "sign_getdefined()" function
|
/// "sign_getdefined()" function
|
||||||
|
Reference in New Issue
Block a user