fix: do not replace non existing notifications + protect error-prone function calls #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I dismiss the "LSP loading" message, I have an infinite stream of "No matching notification found to replace" spamming me.
The problem was that the spinner was trying to replace the notification that I just dismissed, the solution was to set the
self.notification
tonil
when closing the notification(s).The next problem that arose was due to
self.window
having the same problem and triggering an error, the solution was to set it tonil
as well, one particular call (line208
) sometimes was called beforenvim-notify
had the time to setself.window
tonil
, so I wrapped it in apcall
to suppress the error.Lastly, it's a hack I've seen in other plugins but
options.notify
expects astring
as first parameter (msg
), passing an empty string causes the message to flicker when the spinner animates so it needs to staynil
.My solution was to
pcall
spinner_start
(line325
).I tried to change as little code as possible and this was the only way I've found to solve that bug.
This would fix #13