mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(picker): added notifications
picker. Closes #738
This commit is contained in:
parent
0cb5bdf4ee
commit
32cffd2e60
5 changed files with 71 additions and 2 deletions
23
lua/snacks/picker/source/snacks.lua
Normal file
23
lua/snacks/picker/source/snacks.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
local M = {}
|
||||
|
||||
---@param opts snacks.picker.notifications.Config
|
||||
function M.notifier(opts)
|
||||
local notifs = Snacks.notifier.get_history({ filter = opts.filter })
|
||||
local items = {} ---@type snacks.picker.finder.Item[]
|
||||
|
||||
for _, notif in ipairs(notifs) do
|
||||
items[#items + 1] = {
|
||||
text = Snacks.picker.util.text(notif, { "level", "title", "msg" }),
|
||||
item = notif,
|
||||
severity = notif.level,
|
||||
preview = {
|
||||
text = notif.msg,
|
||||
ft = "markdown",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return items
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue