Open britter opened 3 months ago
Pinging maintainer @Philipp-M. WDYT?
usuallly you would install those grammars via, wouldn't you ? not using hx but that's how nix+neovim does it
I'm not sure whether that should be in a default activation hook, it takes some time, and I doubt that custom grammars are used by a lot of people. But I think this could be done though, when programs.helix.languages.grammar
is set. I'm happy to review a PR doing that.
usuallly you would install those grammars via, wouldn't you ? not using hx but that's how nix+neovim does it
(I'm guessing you meant "Nix") Unfortunately not that easy yet in helix, see the discussion in https://github.com/nix-community/home-manager/issues/2871#issuecomment-1264459501. At some point, I think that feature could be added upstream, as I think installing via nix is certainly cleaner.
@Philipp-M I can give it a shot. Not sure when I will get to it though. Maybe we can call fetch
and build
only for the grammars that are explicitly defined in languages
. I don't recall whether the commands take a grammar name as an argument. Will check.
I think it only builds things defined in languages.toml
as per the help message:
-g, --grammar {fetch|build} Fetches or builds tree-sitter grammars listed in languages.toml
Also it fails since it need a toolchain present for building them, which I think should not be done outside of nix.
@SrEstegosaurio as far as I can tell on my system it builds both, the built in grammars defined in the languages.toml that it ships with as well as the user supplies grammars from the user space language.toml.
I might mention that I'm using the h-m module in conjunction with the upstreram latest nix pacakge.
@britter do you happen to have a C/C++ compiler globally available?
No, I load it into nix shell
when I need to rebuild grammars. That works well enough for me.
Description
When configuring custom grammars using the
languages
option, one needs to remember to runhx --grammar fetch
andhx --grammar build
. Otherwise the newly configured grammar does not work. This could be added as an activation step, much like the one for bat.