fix: replace deprecated table operations for neovim v0.10 - #489
Conversation
FunctionalHacker
commented
Apr 25, 2024
Just tested this on my machine, works well! |
Can you try with the command |
mikesmithgh
commented
Apr 30, 2024
|
I am using Neogit, that uses diffview.nvim. I have the same problem on markdowns (.md) files only. Other diffs are OK (.json, etc) |
LinoWhy
commented
Apr 30, 2024
@mikesmithgh I meet the same issue, with the following error: |
serranomorante
commented
Apr 30, 2024
diffview-issue.webm |
mikesmithgh
commented
Apr 30, 2024
@serranomorante@LinoWhy@ctretyak thank you for pointing this out. TL;DR;
My branch accidentally reverted to main that is why I did not see the error. So, that is one thing to point out. It seems like the latest nightly nvim may no longer be crashing due to the deprecated usage. So, you may not need to point to this branch unless you would like to test this functionality. The issue appeared to be related to flatten. vim.iter({ 1, { 2 }, { { 3 } } }):flatten():totable()
-- result: { 1, 2, { 3 } }vsvim.iter({ 1, { 2 }, { { 3 } } }):flatten(math.huge):totable()
-- result: { 1, 2, 3 }
|
Upstream has some issues with the latest release of NeoVim: - sindrets/diffview.nvim#492 - sindrets/diffview.nvim#489
Unlike the `iter(...):flatten()` alternative, this handles lists with holes.
sindrets
left a comment
There was a problem hiding this comment.
Thank you!
I made a small change where I opted to use the old implementation of tbl_flatten() from Neovim because unlike the iter(...):flatten() alternative, it handles lists with holes.
mikesmithgh
commented
May 19, 2024
Awesome! 😎 |


Resolves#488.
Neovim nightly deprecated some table operations resulting in diffview.nvim crashes. I've moved the operations
islistandflattento the utils package so that we can apply the appropriate function depending on the Neovim version.Please let me know what you think, thanks!