folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Apache License 2.0
4.42k stars 102 forks source link

bug: message title does not pass through to a cond filter #989

Closed tris203 closed 2 hours ago

tris203 commented 2 hours ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.11 dev

Operating system/version

Ubuntu 22.04

Describe the bug

Title doesnt seem to be passed through the message object in a cond filter of a route

Steps To Reproduce

  1. run the below code
    vim.notify("hello", vim.log.levels.info, { title = "test" })
    vim.notify("hello", vim.log.levels.info)
  2. observe that both notifications go to the mini view

Expected Behavior

if the message has a title it should go to mini view, if not it should fall through and be displayed normally.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "folke/noice.nvim",
      opts = {
        routes = {
          {
            filter = {
              event = "notify",
              kind = "info",
              cond = function(message)
                if message.title then
                  return true
                else
                  return false
                end
              end,
            },
            view = "mini",
          },
        },
      },
    },
    -- add any other plugins here
  },
})
folke commented 2 hours ago

message.opts.title