Closed smjonas closed 2 years ago
Just reviewed. thanks for the PR
@quangnguyen30192 I just noticed we don't even need nvim-treesitter as a dependency. We can simply copy those functions from the nvim-treesitter plugin. Since Treesitter is built into Neovim we will always have the functionality we need.
Cool 😊
@quangnguyen30192 Please review again and test this feature :) E.g. in a CSS code block within a .html file. Also what do you think about adding a "both"
option (as Luasnip also has this option)? See TODO at the top of this PR. Maybe this could be a separate PR if users actually want it.
I don't think there will be noticeable performance issues right now because:
Just tested it and working fine 👍
I don't think there will be noticeable performance issues right now because: Treesitter has already parsed the entire file after entering a buffer then it is simply a lookup for the current node the cursor is on and return the info (no additional logic should be involved) our Python code is only called when Treesitter found a different language than the current filetype of the buffer
Sure, let's go with it for now
E.g. in a CSS code block within a .html file. Also, what do you think about adding a "both" option (as Luasnip also has this option)? See TODO at the top of this PR. Maybe this could be a separate PR if users actually want it.
Do we really need it as of now? Let's add it when the user needs it then.
Heavily inspired by https://github.com/L3MON4D3/LuaSnip/pull/226.
TODO:
filetype_source="both"
to show snippets for the current filetype as well as for the filetype determined by Treesitter? => we chose not to support it right now (if users actually want this feature, we will add it)filetype_source="treesitter"
option)