Bekaboo / dropbar.nvim

IDE-like breadcrumbs, out of the box
GNU General Public License v3.0
1.05k stars 24 forks source link

[Bug]: Removal of path source breaks folke/noice command line #38

Closed Jendker closed 1 year ago

Jendker commented 1 year ago

Description

Hello, Thank you so much for a great plugin! It works great in many cases when my nvim-navic did not stand up to the challenge :)

I have one issue. I wanted to remove the path information from bar. To this end I have removed sources.path from bar.sources as described in the minimal config below. The problem is that now the : or / does not show command line from "folke/noice". If I re-add sources.path to bar.sources, then : or / both work fine.

nvim version

v0.10.0-dev-528+g1f8fb7c00

dropbar.nvim version

190dcc1

Operating system and version

Ubuntu 20.04

Minimal config

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

-- Indent Settings
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.smartindent = true

require("lazy").setup({
  { 'Bekaboo/dropbar.nvim',
    opts = {
      bar = {
        sources = function(_, _)
          local sources = require('dropbar.sources')
          return {
            {
              get_symbols = function(buf, win, cursor)
                if vim.bo[buf].ft == 'markdown' then
                  return sources.markdown.get_symbols(buf, win, cursor)
                end
                for _, source in ipairs({
                  sources.lsp,
                  sources.treesitter,
                }) do
                  local symbols = source.get_symbols(buf, win, cursor)
                  if not vim.tbl_isempty(symbols) then
                    return symbols
                  end
                end
                return {}
              end,
            },
          }
        end,
      },
    }
  },
  {
    "folke/noice.nvim",
    event = "VeryLazy",
    opts = {
      -- add any options here
    },
    dependencies = {
      -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
      "MunifTanjim/nui.nvim",
    }
  }
})

Steps to reproduce

  1. Save the above configuration as minimal.lua
  2. Run nvim --clean -u minimal.lua minimal.lua
  3. Press :

Expected behavior

Command line from folke/noice appears as expected.

You can see the correct behavior with this minimal.lua:

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

-- Indent Settings
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.smartindent = true

require("lazy").setup({
  { 'Bekaboo/dropbar.nvim',
    opts = {
      bar = {
        sources = function(_, _)
          local sources = require('dropbar.sources')
          return {
            sources.path,
            {
              get_symbols = function(buf, win, cursor)
                if vim.bo[buf].ft == 'markdown' then
                  return sources.markdown.get_symbols(buf, win, cursor)
                end
                for _, source in ipairs({
                  sources.lsp,
                  sources.treesitter,
                }) do
                  local symbols = source.get_symbols(buf, win, cursor)
                  if not vim.tbl_isempty(symbols) then
                    return symbols
                  end
                end
                return {}
              end,
            },
          }
        end,
      },
    }
  },
  {
    "folke/noice.nvim",
    event = "VeryLazy",
    opts = {
      -- add any options here
    },
    dependencies = {
      -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
      "MunifTanjim/nui.nvim",
    }
  }
})

difference - existance of sources.path in line 28.

Actual behavior

Command line does not appear.

Additional information

If I am missing something and the removal of sources.path from bar.sources is not the correct approach to remove path information from bar, please let me know.

Bekaboo commented 1 year ago

Thanks for reporting. Have no idea how this plugin can affect noice -- very strange -- will look into it later.

Jendker commented 1 year ago

Thank you! Please take your time. It's nothing urgent but would be great if there is a solution to this.

Bekaboo commented 1 year ago

@Jendker Have you tried to report this issue to folke/noice.nvim? I mean, if noice.nvim takes over the UI, it is more likely that it is some settings in noice that breaks the default behavior, so better to report the bug there. I tried to tracked down the issue for several hours but still cannot find a clue :(

Jendker commented 1 year ago

Thank you so much for taking your time to investigate this! In this case I'll refer to this issue on folke/noice.nvim repository and report back as I get more information.

Bekaboo commented 1 year ago

@Jendker No need to do that now, I believe the latest commit fixes the issue, you are welcomed to report it to folke though.