Skip to content
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

Parse error when encountering -- at beginning of deleted line containing ++ #13

Open
ambroisie opened this issue May 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ambroisie
Copy link

I was puzzled why the bit after a comment in a Lua file was not getting highlighted in red, turns out it is a parse ERROR according to :InspectTree:

Reproducer

diff --git a/modules/home/vim/plugin/settings/null-ls.lua b/modules/home/vim/plugin/settings/null-ls.lua
index e7265c7..eadf16a 100644
--- a/modules/home/vim/plugin/settings/null-ls.lua
+++ b/modules/home/vim/plugin/settings/null-ls.lua
@@ -18,16 +18,6 @@ null_ls.register({
     }),
 })
 
--- C, C++
-null_ls.register({
-    null_ls.builtins.formatting.clang_format.with({
-        -- Only used if available, but prefer clangd formatting if available
-        condition = function()
-            return utils.is_executable("clang-format") and not utils.is_executable("clangd")
-        end,
-    }),
-})
-
 -- Nix
 null_ls.register({
     null_ls.builtins.formatting.nixpkgs_fmt.with({
[...]
     (deletion) ; '---'
     (ERROR) ; '++'
      (ERROR) ; 'C, C'
[...]

@the-mikedavis
Copy link
Owner

That looks to me like tree-sitter's error correction is being overzealous. I'm not sure there's anything we can do in this grammar to fix it but if you can find a way to make the grammar behave better in this scenario I would be interested in a PR!

@the-mikedavis the-mikedavis added the bug Something isn't working label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants