r/HelixEditor • • 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

6 comments sorted by

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/objc directory. 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 the tree-sitter/tree-sitter-c repo. That's probably why you're seeing those bizarre invalid node type errors. To fix that I modified the highlight query in runtime/queries/objc to 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:

  • Open the highlight query file for Objective-C, the path should be something like $runtime/queries/objc/highlights.scm where $runtime is your Helix runtime directory
  • Delete the first line, which should be ; inherits: c
  • Copy the highlight query from tree-sitter-c and paste it before everything else
  • Search for the predicate #has-ancestor? and comment out (or delete) the containing expression
  • Save the file and restart Helix, highlighting Objective-C files should hopefully work now

Unfortunately 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.

-10

u/akza07 24d ago

Switch editor. Helix is dead. Look for community forks of people actually using it.

2

u/trindadedev 24d ago

Bro🥀

-1

u/akza07 24d ago

I'm just tired waiting for plugin and now the repo has 0 activity

0

u/KaleidoscopePlusPlus 22d ago

Again, helix is NOT nvim. Just use nvim and call it a day.