Skip to content

Commit

Permalink
fix(notifications): add title to notifications (Saghen#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser authored Dec 22, 2024
1 parent 8620a94 commit f93af0f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lua/blink/cmp/completion/accept/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lua/blink/cmp/completion/windows/documentation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 9 additions & 3 deletions lua/blink/cmp/fuzzy/download/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lua/blink/cmp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lua/blink/cmp/sources/cmdline/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion lua/blink/cmp/sources/snippets/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f93af0f

Please sign in to comment.