From 7f5b8d8168aab157430426a058d83e326abc9f03 Mon Sep 17 00:00:00 2001 From: karitham Date: Wed, 17 Jun 2026 00:35:05 +0200 Subject: [PATCH] helix: prr tree-sitter --- modules/dev/editor/helix.nix | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/modules/dev/editor/helix.nix b/modules/dev/editor/helix.nix index b13cbad..0050dbf 100644 --- a/modules/dev/editor/helix.nix +++ b/modules/dev/editor/helix.nix @@ -31,6 +31,24 @@ let nufmt ] ++ [ self'.packages.gotools ]; + + tree-sitter-prr = pkgs.stdenv.mkDerivation { + pname = "tree-sitter-prr"; + version = "unstable-2026-04-02"; + src = pkgs.fetchFromGitHub { + owner = "colinmarc"; + repo = "tree-sitter-prr"; + rev = "a0c26e79b038940e5e7030209985bfc103ebd8ef"; + hash = "sha256-iZg/TFAHph49ojTkNCCORIr2B/fAjPOL99FLpmdJBYo="; + }; + buildPhase = '' + $CC -fPIC -Isrc -c src/parser.c -o parser.o + $CC -shared -o prr.so parser.o + ''; + installPhase = '' + install -Dm755 prr.so $out/lib/prr.so + ''; + }; in lib.mkIf osConfig.dev.editor.enable { home.packages = global-tools; @@ -39,6 +57,20 @@ lib.mkIf osConfig.dev.editor.enable { (require "plugins.scm") ''; + xdg.configFile."helix/runtime/grammars/prr.so".source = "${tree-sitter-prr}/lib/prr.so"; + xdg.configFile."helix/runtime/queries/prr/highlights.scm".text = '' + (file_header) @namespace + (index_line) @comment + (old_file) @comment + (new_file) @comment + (hunk_header) @function + (addition) @diff.plus + (deletion) @diff.minus + (tag_name) @keyword + (tag_value) @string + (comment) @comment + ''; + programs.helix = { enable = true; defaultEditor = true; @@ -589,6 +621,12 @@ lib.mkIf osConfig.dev.editor.enable { language-servers = [ "thriftls" ]; auto-format = true; } + { + name = "prr"; + scope = "source.prr"; + file-types = [ "prr" ]; + grammar = "prr"; + } ] ++ map (lang: { name = lang; }) [ "git-attributes" -- 2.51.2