Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove deprecated use of vim.tbl_add_reverse_lookup #1931

Merged
merged 1 commit into from
May 17, 2024

Conversation

lewis6991
Copy link
Contributor

No description provided.

@phush0
Copy link

phush0 commented May 17, 2024

merge pls msg is anoying

@hrsh7th
Copy link
Owner

hrsh7th commented May 17, 2024

thank you!

@hrsh7th hrsh7th merged commit 31a2939 into hrsh7th:main May 17, 2024
2 checks passed
@lewis6991 lewis6991 deleted the depr branch May 17, 2024 06:59
@AThePeanut4
Copy link
Contributor

@hrsh7th @lewis6991 This iterates while adding new keys, which doesn't seem to cause any issues but is technically undefined afaik. vim.tbl_add_reverse_lookup uses vim.tbl_keys to get around this issue.

@lewis6991
Copy link
Contributor Author

Yes, I just realised that. Hopefully this doesn't cause an issue but fixing should be easy if it does.

@yioneko
Copy link
Contributor

yioneko commented Jul 8, 2024

I could confirm this causes some kv pairs not added on my end. I added a print statement just after the loop assignments:

diff --git a/lua/cmp/types/lsp.lua b/lua/cmp/types/lsp.lua
index 65d6301..2dfa192 100644
--- a/lua/cmp/types/lsp.lua
+++ b/lua/cmp/types/lsp.lua
@@ -205,6 +205,7 @@ lsp.CompletionItemKind = {
 for k, v in pairs(lsp.CompletionItemKind) do
   lsp.CompletionItemKind[v] = k
 end
+vim.print(lsp.CompletionItemKind)
 
 ---@class lsp.internal.CompletionItemDefaults
 ---@field public commitCharacters? string[]

And occasionally it shows that some pairs are not correctly added:

image

Reference at index 18 is missing this time. The missing kind is random, and I've seen kinds Function and Text could also disappear in completion window.

@yioneko yioneko mentioned this pull request Jul 12, 2024
2 tasks
AThePeanut4 added a commit to AThePeanut4/nvim-cmp that referenced this pull request Jul 16, 2024
dansdantas added a commit to dansdantas/nvim-cmp that referenced this pull request Sep 4, 2024
fixup! fix: remove deprecated use of vim.tbl_add_reverse_lookup (hrsh7th#1931)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants