aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/notify.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-08-12 22:43:22 +0200
committerWilliam Boman <william@redwill.se>2021-08-12 22:48:59 +0200
commit125ee038c61476e7ef4294c43f4cf7969a777e21 (patch)
tree26454ede9e762dc6281bcb3a67864614758e792b /lua/nvim-lsp-installer/notify.lua
parentvim.notify: provide extra options for better interop with nvim-notify (diff)
downloadmason-125ee038c61476e7ef4294c43f4cf7969a777e21.tar
mason-125ee038c61476e7ef4294c43f4cf7969a777e21.tar.gz
mason-125ee038c61476e7ef4294c43f4cf7969a777e21.tar.bz2
mason-125ee038c61476e7ef4294c43f4cf7969a777e21.tar.lz
mason-125ee038c61476e7ef4294c43f4cf7969a777e21.tar.xz
mason-125ee038c61476e7ef4294c43f4cf7969a777e21.tar.zst
mason-125ee038c61476e7ef4294c43f4cf7969a777e21.zip
notify: improved interop with nvim-notify plugin
Diffstat (limited to 'lua/nvim-lsp-installer/notify.lua')
-rw-r--r--lua/nvim-lsp-installer/notify.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/lua/nvim-lsp-installer/notify.lua b/lua/nvim-lsp-installer/notify.lua
index ef6db61b..010ba31c 100644
--- a/lua/nvim-lsp-installer/notify.lua
+++ b/lua/nvim-lsp-installer/notify.lua
@@ -1,8 +1,13 @@
local TITLE = "nvim-lsp-installer"
return function(msg, level)
+ local has_notify_plugin, notify = pcall(require, "notify")
level = level or vim.log.levels.INFO
- vim.notify(("%s: %s"):format(TITLE, msg), level, {
- title = TITLE,
- })
+ if has_notify_plugin then
+ notify(msg, level, {
+ title = TITLE,
+ })
+ else
+ vim.notify(("[%s] %s"):format(TITLE, msg), level)
+ end
end