-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No matching notification found to replace #181
Comments
Hi, could you try this: if val.kind == "begin" then
local message = format_message(val.message, val.percentage)
notif_data.notification = vim.notify(message, "info", {
title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
icon = spinner_frames[1],
timeout = 100,
hide_from_history = false,
replace = notif_data.notification.id -- <--- This will hopefully help resolve the issue
})
|
In my case I wanted to show notifications that are dismissed after 2000ms, also I wanted to reuse same notification as I run this function multiple times. The workaround for me was to clean up notification record local notifications = {}
local function toggle_theme()
-- code to toggle theme
local options = {
title = 'Colorscheme',
timeout = 2000,
replace = notifications.current,
hide_from_history = true,
animate = true,
render = 'compact',
on_close = function() notifications.current = nil end, -- this line will fix the error
}
notifications.current = vim.notify(vim.g.current_theme .. ' set', vim.log.levels.INFO, options)
end |
@dmmulroy I tried adding that line, I see the lsp
Which is an error pointing to the line added. Here is the full code: vim.lsp.handlers["$/progress"] = function(_, result, ctx)
local client_id = ctx.client_id
local val = result.value
if not val.kind then
return
end
local client_name = vim.lsp.get_client_by_id(client_id).name
if client_name == "null-ls" then
return
end
-- if title == "null-ls"
local notif_data = get_notif_data(client_id, result.token)
if val.kind == "begin" then
local message = format_message(val.message, val.percentage)
notif_data.notification = vim.notify(message, "info", {
title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
icon = spinner_frames[1],
timeout = 100,
hide_from_history = false,
})
notif_data.spinner = 1
update_spinner(client_id, result.token)
elseif val.kind == "report" and notif_data then
notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
replace = notif_data.notification,
hide_from_history = false,
})
elseif val.kind == "end" and notif_data then
notif_data.notification = vim.notify(val.message and format_message(val.message) or "Complete", "info", {
icon = "",
replace = notif_data.notification,
timeout = 100,
})
notif_data.spinner = nil
end
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, my configuration has been working fine for a while now. All of the sudden I started to get
this message. I'm not sure what this means or where to fix it?
This is might be of interest I don't know.
Thanks
The text was updated successfully, but these errors were encountered: