-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Resolve parser lang when different from filetype #14
Conversation
Use nvim-treesitter API to resolve the parser language when it is different than the buffer's `filetype`. This happens for `tsx` files whose `filetype` is `typescriptreact` but the Treesitter parser language is `tsx`. The mapping of filetypes and parser languages is stored in nvim-treesitter [0]. PR #4 fixed that problem before. It seems that the solution stopped working over time. [0]: https://github.com/nvim-treesitter/nvim-treesitter/blob/32e364ea3c99aafcce2ce735fe091618f623d889/lua/nvim-treesitter/parsers.lua#L4-L21
Sorry but I don't want this plugin to depend on nvim-treesitter. It should only depend on treesitter APIs that are part of neovim core. |
That's surprising to me. Regardless, do you have a suggestion how to fix the problem with the parser language being different that filetypes without requiring |
Part of the intention of nvim-treesitter was to have a faster moving playground to experiment with the treesittter and additional APIs before they go into core. But the goal is to have everything necessary to create plugins like this without nvim-treesitter. If necessary components are missing these should eventually make it into core. There is already work ongoing in this direction (e.g. neovim/neovim#18232). As a neovim core contributor myself part I'd rather help in that regard and keep my plugins free of nvim-treesitter. It's not that there is anything wrong with nvim-treesitter itself, it's that this helps inform what might be needed in neovim core itself.
Not yet, I'll have to take a closer look at why it broke (or ever worked) |
I see, thanks for a thorough explanation. I believe I understand why you want to keep away from using |
See #30 |
Use nvim-treesitter API to resolve the parser language when it is different than the buffer's
filetype
.This happens for
tsx
files whosefiletype
istypescriptreact
but the Treesitter parser language istsx
. The mapping of filetypes and parser languages is stored in nvim-treesitter.PR #4 fixed that problem before. It seems that the solution stopped working over time.
Closes #17
Before (on
master
)Peek.2022-06-11.11-02.mp4
After
Peek.2022-06-11.11-01.mp4