Open thallada opened 1 year ago
So after looking into this a bit, it looks like this line is causing issues. We are passing typescriptreact
as the 2nd argument, but we need to use tsx
instead. It looks like Neovim maintains a correspondence table, so we should use that instead if it's not specifically marked internal.
However, I also think something is broken upstream. as the following steps can also reproduce your issue independent of null-ls:
It looks like just calling get_parser()
with a nonexistent language breaks Treesitter for subsequent buffers, even when using pcall
(which is what the todo_comments
source does). It might be worth reporting if you're up for it.
Thanks for the investigation, I opened an issue here: https://github.com/nvim-treesitter/nvim-treesitter/issues/4693
I made a PR with the change you recommended here: https://github.com/jose-elias-alvarez/null-ls.nvim/pull/1533
I am new to lua and neovim development in general. Is there a reason to use pcall
over xpcall
? It seems like it would have been a lot easier to figure this bug out if I had gotten some sort of alert or log that this error happened, but .pcall
apparently swallows any error into the void
Edit: I read up more on pcall
. It does return the error message if there is one. todo_comments
should probably log the error if there is one returned.
FAQ
Issues
Neovim Version
v0.9.0
Dev Version?
Operating System
MacOS (but also reproducible on WSL Linux)
Minimal Config
Steps to Reproduce
nvim --clean -u minimal_init.lua
:e sample1.tsx
const Sample1 = () => { const sample1 = "sample1"; return (
{sample1}
); };
sample2.tsx
on the left has broken syntax highlighting whilesample1.tsx
on the right has the correct syntax highlighting (notice colors ofimport
,const
, and jsx tags).Reproducibility Check
minimal_init.lua
template and that my issue is reproducible by runningnvim --clean -u minimal_init.lua
and following the steps above.Expected Behavior
I expect all
typescriptreact
buffers I open to have consistent syntax highlighting from thetsx
treesitter plugin.Actual Behavior
Only new
typescriptreact
buffers I open after the first initialtypescriptreact
buffer have incorrect syntax highlighting.Removing the
null_ls.builtins.diagnostics.todo_comments
source from the nullls config fixes the issue.Debug Log
Dates are not recent, so I think these errors are not related:
Help
Yes, but I don't know how to start. I would need guidance
Implementation Help
It took me a long time to narrow down the issue to
null-ls
and thentodo_comments
. It would be great if null-ls echoed a more obvious error if there is an error in one of the plugins that causes syntax to break (I still have not found any error message that would point to what abouttodo_comments
is breaking this).Requirements