From f93af0f486ada13e8c34f42c911788b9232b811f Mon Sep 17 00:00:00 2001 From: Chris Grieser <73286100+chrisgrieser@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:13:38 +0100 Subject: [PATCH] fix(notifications): add title to notifications (#722) --- lua/blink/cmp/completion/accept/init.lua | 2 +- lua/blink/cmp/completion/windows/documentation.lua | 2 +- lua/blink/cmp/fuzzy/download/init.lua | 12 +++++++++--- lua/blink/cmp/init.lua | 2 +- lua/blink/cmp/sources/cmdline/init.lua | 2 +- lua/blink/cmp/sources/snippets/utils.lua | 3 ++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lua/blink/cmp/completion/accept/init.lua b/lua/blink/cmp/completion/accept/init.lua index 6c4df605..53c89d2e 100644 --- a/lua/blink/cmp/completion/accept/init.lua +++ b/lua/blink/cmp/completion/accept/init.lua @@ -99,7 +99,7 @@ local function accept(ctx, item, callback) require('blink.cmp.fuzzy').access(item) end) end) - :catch(function(err) vim.notify(err, vim.log.levels.ERROR) end) + :catch(function(err) vim.notify(err, vim.log.levels.ERROR, { title = 'blink.cmp' }) end) end return accept diff --git a/lua/blink/cmp/completion/windows/documentation.lua b/lua/blink/cmp/completion/windows/documentation.lua index 4d704b3b..0f85e47d 100644 --- a/lua/blink/cmp/completion/windows/documentation.lua +++ b/lua/blink/cmp/completion/windows/documentation.lua @@ -100,7 +100,7 @@ function docs.show_item(context, item) docs.update_position() end end) - :catch(function(err) vim.notify(err, vim.log.levels.ERROR) end) + :catch(function(err) vim.notify(err, vim.log.levels.ERROR, { title = 'blink.cmp' }) end) end function docs.scroll_up(amount) diff --git a/lua/blink/cmp/fuzzy/download/init.lua b/lua/blink/cmp/fuzzy/download/init.lua index 7441d7f9..fb88ec0f 100644 --- a/lua/blink/cmp/fuzzy/download/init.lua +++ b/lua/blink/cmp/fuzzy/download/init.lua @@ -41,8 +41,12 @@ function download.ensure_downloaded(callback) if state.version == target_version and state.is_downloaded then return files.verify_checksum():catch(function(err) vim.schedule(function() - vim.notify(err, vim.log.levels.WARN) - vim.notify('Pre-built binary failed checksum verification, re-downloading', vim.log.levels.WARN) + vim.notify(err, vim.log.levels.WARN, { title = 'blink.cmp' }) + vim.notify( + 'Pre-built binary failed checksum verification, re-downloading', + vim.log.levels.WARN, + { title = 'blink.cmp' } + ) end) return download.download(target_version) end) @@ -52,7 +56,9 @@ function download.ensure_downloaded(callback) if not target_version then error('Unknown error while getting pre-built binary. Consider re-installing') end -- download as per usual - vim.schedule(function() vim.notify('Downloading pre-built binary', vim.log.levels.INFO) end) + vim.schedule( + function() vim.notify('Downloading pre-built binary', vim.log.levels.INFO, { title = 'blink.cmp' }) end + ) return download.download(target_version) end) :map(function() callback() end) diff --git a/lua/blink/cmp/init.lua b/lua/blink/cmp/init.lua index 80a5cc88..a3c439b8 100644 --- a/lua/blink/cmp/init.lua +++ b/lua/blink/cmp/init.lua @@ -10,7 +10,7 @@ function cmp.setup(opts) local version = vim.version() if version.major == 0 and version.minor < 10 then - vim.notify('blink.cmp only supports nvim 0.10 and newer', vim.log.levels.ERROR) + vim.notify('blink.cmp only supports nvim 0.10 and newer', vim.log.levels.ERROR, { title = 'blink.cmp' }) return end diff --git a/lua/blink/cmp/sources/cmdline/init.lua b/lua/blink/cmp/sources/cmdline/init.lua index 1d4c5f0e..9d85fbca 100644 --- a/lua/blink/cmp/sources/cmdline/init.lua +++ b/lua/blink/cmp/sources/cmdline/init.lua @@ -78,7 +78,7 @@ function cmdline:get_completions(context, callback) }) end) :catch(function(err) - vim.notify('Error while fetching completions: ' .. err, vim.log.levels.ERROR) + vim.notify('Error while fetching completions: ' .. err, vim.log.levels.ERROR, { title = 'blink.cmp' }) callback({ is_incomplete_backward = false, is_incomplete_forward = false, items = {} }) end) diff --git a/lua/blink/cmp/sources/snippets/utils.lua b/lua/blink/cmp/sources/snippets/utils.lua index b323b593..f0903b77 100644 --- a/lua/blink/cmp/sources/snippets/utils.lua +++ b/lua/blink/cmp/sources/snippets/utils.lua @@ -10,7 +10,8 @@ function utils.parse_json_with_error_msg(path, json) if not ok then vim.notify( 'Failed to parse json file "' .. path .. '" for blink.cmp snippets. Error: ' .. parsed, - vim.log.levels.ERROR + vim.log.levels.ERROR, + { title = 'blink.cmp' } ) return {} end