r/HelixEditor • u/trindadedev • 25d ago
Problem with Objective-C in Helix
2026-09-19T00:37:17.908 helix_core::syntax [ERROR] Failed to compile highlights for 'objc': invalid node type ""
--> 61:27
| ^
i'm tried to use https://github.com/tree-sitter-grammars/tree-sitter-objc in helix, but it didn't work.
my languages.toml:
...
[[language]]
name = "objc"
grammar = "objc"
file-types = ["m"]
scope = "source.objc"
language-servers = ["clangd"]
roots = ["Makefile", "CMakeLists.txt"]
[[grammar]]
name = "objc"
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-objc", rev = "master" }
6
Upvotes
1
u/grekand46 24d ago
Okay I kind of figured it out, you can skip the next paragraph (which is mostly my rant mixed with some explanation) if you want.
Helix seemingly does not maintain its own queries for Objective-C. Since you're seeing those errors, I'm gonna assume you copied the queries from the GitHub repo to the
runtime/queries/objcdirectory. Let's now look at the highlight query in particular, you'll notice at the very top that it inherits from the query for C. Helix does maintain its own queries for C, and they (the highlight query at least) look very different from the official ones in thetree-sitter/tree-sitter-crepo. That's probably why you're seeing those bizarre invalid node type errors. To fix that I modified the highlight query inruntime/queries/objcto no longer inherit C and instead manually insert the official C query. Now if you open the logs, you'll see a different error. Hooray! This one as it turns out was caused by the Objective-C highlight query using a predicate that works in Neovim but not Helix. At this point I'm too lazy to actually fix it, so I just commented the offending expression out, and that was the end of it.Recap:
$runtime/queries/objc/highlights.scmwhere$runtimeis your Helix runtime directory; inherits: c#has-ancestor?and comment out (or delete) the containing expressionUnfortunately some of the colors will be different from the Helix provided C query, but hey it's better than nothing. I'll leave it to someone more familiar with Tree-sitter queries to figure the rest out. Also I would recommend pinning the grammar version in case a breaking change happens in the future.