Replies: 10 comments
-
I'm not sure what the ask is here, especially on NixOS grammars tend to get built with an glibc then as the system updates they become outdated. There's nothing we can do on the editor side to load these |
Beta Was this translation helpful? Give feedback.
-
But there's probably something you can do to not load them and use system grammars instead, or at the very least warn that there's multiple around. And, as said, it wasn't about the grammars being outdated: Completely rebuilding them didn't change a thing. |
Beta Was this translation helpful? Give feedback.
-
Just did a little experiment: With everything already working again, do |
Beta Was this translation helpful? Give feedback.
-
queries are like user config files. They don't ship with the grammars (they are part of the helix repo) and can't be automatically updated. If your query files are wrong then that's a user/installation error. The query files must match the grammar version (which is why grammars are fixed to specific commit in |
Beta Was this translation helpful? Give feedback.
-
Then something like the following must have happened:
In the nixos case, or generally when grammars are installed on a system-level it doesn't seem to make sense to have For the cargo-install case -- well, on its own it's not broken, either, up-to date queries will be copied over. Thus the issue is an incompatibility in how those two install methods install and prioritise loading, and should be able to be fixed by ignoring data in Side note: The runtime data dir should probably be |
Beta Was this translation helpful? Give feedback.
-
the current behavior is quite intentional because the expectation is that package managers place their files at the system level and user customize their queries in |
Beta Was this translation helpful? Give feedback.
-
I respectfully disagree about the "queries are config files" part. I see things like
in there, I don't think any user will ever customize their rust keywords. They look like semantic annotations for a grammar to me, translating tree sitter semantics into helix theme semantics (I suppose), I wouldn't expect anyone not actively developing a grammar to touch those files. I certainly didn't, they bit-rotted away in a directory called Though if you insist another idea would be to annotate the query files with the grammar they're written against, then |
Beta Was this translation helpful? Give feedback.
-
users often add their own grammars, update existing grammars and yes customizing makes a lot of sense because while some cases might be quite clear it can be subjective what highlight group you want to apply to a specific object in a language.
that's impossible there is no way to associate a grammar with a query. |
Beta Was this translation helpful? Give feedback.
-
I stumbled upon this ticket when my highlight was broken so let me add my $0.02: I just built the grammars once (not adding custom ones) when I was debugging an issue to a specific grammar. Then I completely forgot about this fact and after a few weeks my syntax highlight broke for certain formats. Of course, custom grammars and user-level settings overriding system settings is a good practice in general, but in this specific case Helix should imho at least print out a warning when a user grammar is outdated compared to an existing system grammar. I mean, how many people really use customized grammars for which an upstream version is already maintained? And would those people benefit from such warning message as well? Imho yes - for two reasons:
|
Beta Was this translation helpful? Give feedback.
-
Just for the record if anybody ends up in this thread as well. I ended up having helix in a state where none of the highlighting worked anymore. I inspected |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Echoing the "after close" reports in #3634, Helix failed to highlight syntax for me, relevant log attached.
Installed today, 23.03, via the nix flake, on nixos. Note that that installs grammars system-wide.
hx -g fetch
andhx -g build
did not change a thing.The culprit, as it turns out, were stray
grammar
andquery
directories in~/.config/helix/runtime
, presumably from a previous install via cargo.Maybe of note: While the grammars had today's mtime, the queries were ancient. Should
-g
also update those? Though failing with a.so
load error seems strange for a grammar/query mismatch (not that I looked at the code, though :). The.so
s themselves were linked for nixos, nothing suspicious there.Deleting those directories fixed things for me but it doesn't seem like helix should fail here in the first place.
Reproduction Steps
No response
Helix log
~/.cache/helix/helix.log
Platform
Linux / NixOS
Terminal Emulator
alacritty 0.10.1 ()
Helix Version
helix 23.03
Beta Was this translation helpful? Give feedback.
All reactions