romgrk / barbar.nvim

The neovim tabline plugin.
2.26k stars 85 forks source link

vim.tbl_add_reverse_lookup is deprecated :help deprecated. This feature will be removed in Nvim version 0.12 #571

Closed av1155 closed 5 months ago

av1155 commented 5 months ago

Description I get the following two errors when I open neovim:

vim.tbl_add_reverse_lookup is deprecated :help deprecated
This feature will be removed in Nvim version 0.12

AND

stack traceback:
    ...l/share/nvim/lazy/barbar.nvim/lua/barbar/utils/table.lua:53: in function 'add_reverse_lookup'
    ....local/share/nvim/lazy/barbar.nvim/lua/barbar/buffer.lua:34: in main chunk
    [C]: in function 'require'
    .../.local/share/nvim/lazy/barbar.nvim/lua/barbar/state.lua:24: in main chunk
    [C]: in function 'require'
    ...i/.local/share/nvim/lazy/barbar.nvim/lua/barbar/bbye.lua:50: in main chunk
    [C]: in function 'require'
    ...ti/.local/share/nvim/lazy/barbar.nvim/lua/barbar/api.lua:21: in main chunk
    [C]: in function 'require'
    ...aventi/.local/share/nvim/lazy/barbar.nvim/lua/barbar.lua:9: in main chunk
    ...
    [C]: in function 'xpcall'
    .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in function 'source'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in function 'packadd'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:346: in function '_load'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
    ...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:83: in function <...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:72>
    [C]: in function 'nvim_exec_autocmds'
    .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:152: in function <.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:147>

To Reproduce

init.lua (I am using AstroNvim distribution):

-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
  -- stylua: ignore
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)

-- validate that lazy is available
if not pcall(require, "lazy") then
  -- stylua: ignore
  vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
  vim.fn.getchar()
  vim.cmd.quit()
end

require "lazy_setup"
require "polish"

" Set your options here

    -- ==========================================================

    -- barbar (tabline)
    {
        "romgrk/barbar.nvim",
        dependencies = {
            "nvim-tree/nvim-web-devicons",
            "lewis6991/gitsigns.nvim",
        },
        opts = {
            -- configurations go here
            animation = true,
            insert_at_start = false,
            icons = {
                -- Configure the base icons on the bufferline.
                -- Valid options to display the buffer index and -number are `true`, 'superscript' and 'subscript'
                buffer_index = false,
                buffer_number = false,
                button = "",
                -- Enables / disables diagnostic symbols
                diagnostics = {
                    [vim.diagnostic.severity.ERROR] = { enabled = true, icon = " " },
                    [vim.diagnostic.severity.WARN] = { enabled = true, icon = " " },
                    [vim.diagnostic.severity.INFO] = { enabled = true, icon = " " },
                    [vim.diagnostic.severity.HINT] = { enabled = true },
                },
                gitsigns = {
                    added = { enabled = true, icon = "+" },
                    changed = { enabled = true, icon = "~" },
                    deleted = { enabled = true, icon = "-" },
                },
                filetype = {
                    -- Sets the icon's highlight group.
                    -- If false, will use nvim-web-devicons colors
                    custom_colors = false,

                    -- Requires `nvim-web-devicons` if `true`
                    enabled = true,
                },
                -- separator = { left = "▎", right = "" },

                -- If true, add an additional separator at the end of the buffer list
                -- separator_at_end = true,

                -- Configure the icons on the bufferline when modified or pinned.
                -- Supports all the base icon options.
                modified = { button = "◉" },
                pinned = { button = "", filename = true },

                -- Use a preconfigured buffer appearance— can be 'default', 'powerline', or 'slanted'
                -- preset = "powerline",

                -- Configure the icons on the bufferline based on the visibility of a buffer.
                -- Supports all the base icon options, plus `modified` and `pinned`.
                alternate = { filetype = { enabled = false } },
                current = { buffer_index = true },
                inactive = { button = "×" },
                visible = { modified = { buffer_number = false } },
            },
        },
        event = "VeryLazy",
    }, -- End of 'barbar.nvim'

    -- ==========================================================

Steps to reproduce the behavior: Open neovim with barbar plugin installed

Screenshots

Screenshot 2024-04-06 at 2 37 32 PM

Informations Neovim version: NVIM v0.9.5 Build type: Release LuaJIT 2.1.1710088188

romgrk commented 5 months ago

Copied the code for it but didn't remove the deprecation note. I've removed it.

Does that fix both issues or is the stack trace another bug?

av1155 commented 5 months ago

Both are gone! Thank you :)