sourcegraph / sg.nvim

Experimental Sourcegraph + Cody plugin for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vim.tbl_add_reverse_lookup is deprecated. Feature will be removed in Nvim 0.12

jiangyinzuo opened this issue · comments

vim.tbl_add_reverse_lookup in NVIM v0.11.0-dev is deprecated.

vim.tbl_add_reverse_lookup is deprecated. :help deprecated
Feature will be removed in Nvim 0.12
stack traceback:
        vim/shared.lua: in function 'tbl_add_reverse_lookup'
        /root/plugged/sg.nvim/lua/sg/vendored/vim-lsp-rpc.lua:123: in main chunk
        [C]: in function 'require'
        /root/plugged/sg.nvim/lua/sg/request.lua:2: in main chunk
        [C]: in function 'require'
        /root/plugged/sg.nvim/lua/sg/rpc.lua:4: in main chunk
        [C]: in function 'require'
        /root/plugged/sg.nvim/lua/sg/bufread.lua:4: in main chunk
        [C]: in function 'require'
        /root/plugged/sg.nvim/plugin/sg.lua:7: in main chunk

The problem is that it does not have an alternative:

LUA
• vim.loop				Use vim.uv instead.
• vim.tbl_add_reverse_lookup()
• vim.tbl_flatten()		        Use Iter:flatten() instead.
• vim.tbl_islist()			Use vim.islist() instead.

Maybe it is something like this?

function tbl_add_reverse_lookup(t)
    for key, value in pairs(t) do
        t[value] = key
        t[key]   = value
    end
end

Thanks to @tjdevries, the deprecation warning was fixed by #237

Thanks to @tjdevries, the deprecation warning was fixed by #237

It works well for me now, thanks!

Great! Thanks everyone :)