diff options
author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2020-04-28 23:41:39 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 07:41:39 -0700 |
commit | 4e6531ddbdce9944f9986ca5357b71171a14f05e (patch) | |
tree | ddf7ffd295d58d073dda5d43b9b888b488226500 /runtime/lua/vim/lsp.lua | |
parent | 9d0222ee3e232be859c3c70e6681f7156b5ac9d5 (diff) | |
download | rneovim-4e6531ddbdce9944f9986ca5357b71171a14f05e.tar.gz rneovim-4e6531ddbdce9944f9986ca5357b71171a14f05e.tar.bz2 rneovim-4e6531ddbdce9944f9986ca5357b71171a14f05e.zip |
lsp: use vim.tbl_isempty to check sign (#12190)
ref: #12164
fix #12201
sign_getdefined() returns a list, {} if the sign is not defined.
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index c7de2df25f..c01b5d8e0c 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1017,21 +1017,18 @@ function lsp.get_log_path() return log.get_filename() 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. -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('LspDiagnosticsWarningSign', {text='W', texthl='LspDiagnosticsWarning', linehl='', numhl=''}) define_default_sign('LspDiagnosticsInformationSign', {text='I', texthl='LspDiagnosticsInformation', linehl='', numhl=''}) define_default_sign('LspDiagnosticsHintSign', {text='H', texthl='LspDiagnosticsHint', linehl='', numhl=''}) end -define_default_lsp_diagnostics_signs() - return lsp -- vim:sw=2 ts=2 et |