kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.16k stars 37 forks source link

refactor(treesitter): remove nvim-treesitter dependencies #189

Closed wookayin closed 3 months ago

wookayin commented 6 months ago

Replace all the use of nvim-treesitter APIs with core vim.treesitter APIs. No more nvim-treesitter dependency, just core neovim is enough.

This fix makes ufo work without the nvim-treesitter plugin as an additional dependency. In fact, nvim-treesitter v1.0 deprecates and removes some APIs that have been migrated to the core neovim APIs vim.treesitter, which makes ufo's previous treesitter provider implementation incompatible.

Note that this commit does not change the minimum neovim version requirement, should work fine with neovim 0.7.x.

Implementation note:

There are four APIs that need to be migrated:

wookayin commented 6 months ago

@kevinhwang91 You may want to test and make sure there is no performance regression on old neovim versions that are supported by nvim-ufo (0.7, 0.8, and 0.9). I wasn't sure how I can test the performance, so I will leave this part to you.

wookayin commented 5 months ago

@kevinhwang91 What do you think?

kevinhwang91 commented 4 months ago

ufo should be compatible with older nvim version, and nightly is not a stable version, should wait for the official release. FYI: https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable

wookayin commented 4 months ago

This change also works compatible with older nvim versions.

fredrikaverpil commented 3 months ago

I just noticed nightly neovim crashes with ufo when treesitter is used to figure out folding. I wonder if all this could be related (didn't investigate yet)...?

kevinhwang91 commented 3 months ago

I just noticed nightly neovim crashes with ufo when treesitter is used to figure out folding. I wonder if all this could be related (didn't investigate yet)...?

https://github.com/kevinhwang91/nvim-ufo/commit/e29dbf5b2d76ea43f4e585e3deeb6510488eee3f

wookayin commented 3 months ago

@kevinhwang91 Is there anything else you'd like me to address for this PR?

kevinhwang91 commented 3 months ago

Thanks!