Skip to content
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

Getting "No matching notification found to replace" on neovim startup #13

Open
tristan957 opened this issue Jan 17, 2024 · 4 comments · May be fixed by #14
Open

Getting "No matching notification found to replace" on neovim startup #13

tristan957 opened this issue Jan 17, 2024 · 4 comments · May be fixed by #14

Comments

@tristan957
Copy link

See the code where this message is generated: https://github.com/rcarriga/nvim-notify/blob/80b67b265530632505193553d05127ae7fe09ddd/lua/notify/service/init.lua#L69.

I think this is related to testing the replace functionality, but I am not sure. It only happens when this extension is enabled.

---@type LazySpec[]
return {
  {
    "rcarriga/nvim-notify",
    event = "UIEnter",
    config = function()
      local notify = require("notify")

      notify.setup({
        stages = "fade",
      })

      vim.notify = notify
    end,
  },
  {
    "mrded/nvim-lsp-notify",
    dependencies = {
      "rcarriga/nvim-notify",
    },
    event = "UIEnter",
    config = function()
      local lsp_notify = require("lsp-notify")

      -- Because we depend on nvim-notify, vim.notify is a fine default to use.
      -- nvim-notify will handle everything.
      lsp_notify.setup({
        done = ""
      })
    end
  },
}

Apparently, if I comment out event = "UIEnter" it works. Is there a different event that would be better to load this extension on?

@zyriab
Copy link

zyriab commented Feb 8, 2024

I have the same problem if I call notify.dismiss() while the "LSP installing notification" is being displayed (and, therefore, dismissing it). It spams endlessly and I have to restart Neovim in order to stop it.

Here are my configs. Note that calling opts = {} automatically calls the setup function.
I'm guessing it's a check to add before passing something to replace but I haven't had the time to look into it yet.

nvim-notify

---@diagnostic disable: assign-type-mismatch
return {
    "rcarriga/nvim-notify",
    config = function()
        local notify = require("notify")
        -- Overriding vim's notification system
        vim.notify = notify

        vim.keymap.set("n", "<leader><leader>", function()
            notify.dismiss({ silent = true, pending = true })
            vim.cmd("noh")
        end, { desc = "Clear notifications and search highlights" })

        -- Just the default config except for the 3 first properties
        -- This is needed because, otherwise, the diagnostic float
        -- would not open except on line 1
        notify.setup({
            background_colour = "#000000",
            render = "wrapped-compact",
            stages = "fade",
            level = vim.log.levels.INFO,
            timeout = 5000,
            max_width = nil,
            max_height = nil,
            on_open = nil,
            on_close = nil,
            minimum_width = 50,
            fps = 30,
            top_down = true,
            time_formats = {
                notification_history = "%FT%T",
                notification = "%T",
            },
            icons = {
                ERROR = "",
                WARN = "",
                INFO = "",
                DEBUG = "",
                TRACE = "",
            },
        })
    end,
}

nvim-lsp-notify

-- nicer lsp notifications using nvim-notify
return {
    "mrded/nvim-lsp-notify",
    dependencies = { "rcarriga/nvim-notify" },
    opts = {},
}

@Hubro
Copy link

Hubro commented Mar 31, 2024

This issue completely breaks the plugin for me. I have require("notify").dismiss() as part of my default <Esc> keybind, which I press almost constantly. If I happen to press it while an LSP status notification is open, it completely explodes permanently and I have to restart my editor.

@zyriab
Copy link

zyriab commented Mar 31, 2024

This issue completely breaks the plugin for me. I have require("notify").dismiss() as part of my default <Esc> keybind, which I press almost constantly. If I happen to press it while an LSP status notification is open, it completely explodes permanently and I have to restart my editor.

Hey, maybe you can try my fork of the repo, it should be fixed.
I haven't had time to test everything and used to have an error message which I think is related to my changes but haven't had it recently, I'll finish the PR once I have time but perhaps you can try:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants