pmizio / typescript-tools.nvim

⚡ TypeScript integration NeoVim deserves ⚡
MIT License
1.26k stars 36 forks source link

`vim.tbl_add_reverse_lookup` is deprecated in nightly (after nvim 0.10 got released) #266

Closed Gelio closed 2 weeks ago

Gelio commented 1 month ago

The following deprecation notice about `vim.tbl_add_reverse_lookup is shown when loading this plugin:

image
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'
        ...ols.nvim/lua/typescript-tools/protocol/module_mapper.lua:21: in main chunk
        [C]: in function 'require'
        .../typescript-tools.nvim/lua/typescript-tools/tsserver.lua:6: in main chunk
        [C]: in function 'require'
        .../lazy/typescript-tools.nvim/lua/typescript-tools/rpc.lua:3: in main chunk
        [C]: in function 'require'
        ...lazy/typescript-tools.nvim/lua/typescript-tools/init.lua:4: in main chunk
        [C]: in function 'require'
        ...rs/grzegorz.rozdzialik/.config/nvim/lua/lsp/tsserver.lua:19: in function 'setup'
        ...
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:348: in function '_load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:342: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:341>
        [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:341: in function '_load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:123: in function 'startup'
        ...ialik/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
        ...ik/ubuntu-dotfiles/universal/neovim/config/nvim/init.lua:109: in main chunk
Press ENTER or type command to continue
gipo355 commented 1 month ago

nvim version:

NVIM v0.11.0-dev-6+g06135cc21
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

lines affected:

https://github.com/pmizio/typescript-tools.nvim/blob/c43d9580c3ff5999a1eabca849f807ab33787ea7/lua/typescript-tools/api.lua#L215-L227

https://github.com/pmizio/typescript-tools.nvim/blob/c43d9580c3ff5999a1eabca849f807ab33787ea7/lua/typescript-tools/protocol/module_mapper.lua#L21-L21

https://github.com/pmizio/typescript-tools.nvim/blob/c43d9580c3ff5999a1eabca849f807ab33787ea7/lua/typescript-tools/protocol/text_document/custom_diagnostic.lua#L34-L34

shivambegin commented 1 month ago

when this pull request is going to merged?

binhtran432k commented 1 month ago

This is my quick fix for this problem. Instead of waiting all of my plugins to fix it, I override the function on the top of my config.

vim.tbl_add_reverse_lookup = function (tbl)
  for k, v in pairs(tbl) do
    tbl[v] = k
  end
end