diff --git a/apps/nogui/default.nix b/apps/nogui/default.nix index befae1f..8a73f2e 100644 --- a/apps/nogui/default.nix +++ b/apps/nogui/default.nix @@ -42,6 +42,7 @@ # Flake overlays jolheiser.git-age + jolheiser.templ tclip ]; activation.report-changes = config.lib.dag.entryAnywhere '' diff --git a/apps/nogui/helix.nix b/apps/nogui/helix.nix index 8d58588..4a1ec61 100644 --- a/apps/nogui/helix.nix +++ b/apps/nogui/helix.nix @@ -1,4 +1,13 @@ -{ +{pkgs, ...}: let + queries = pkgs.fetchFromGitea { + domain = "git.jojodev.com"; + owner = "jolheiser"; + repo = "templ-helix"; + rev = "2a47b9c5af0fd9ae8bba8198fd66abc6d07fdf10"; + sha256 = "sha256-pTdOX9bPup626t+ko6k3Xq/tprAMAZCUBl+xeIBkhfs="; + }; + query = scm: builtins.readFile (queries + "/queries/templ/${scm}.scm"); +in { programs.helix = { enable = true; defaultEditor = true; @@ -180,6 +189,32 @@ args = ["-qq"]; }; } + { + name = "templ"; + auto-format = true; + scope = "source.templ"; + injection-regex = "templ"; + file-types = ["templ"]; + roots = ["go.mod"]; + comment-token = "//"; + language-server = { + command = "templ"; + args = ["lsp"]; + }; + formatter = { + command = "templ"; + args = ["fmt"]; + }; + } + ]; + grammar = [ + { + name = "templ"; + source = { + git = "https://github.com/vrischmann/tree-sitter-templ"; + rev = "9f63037ad08a58050d0582ef1ae0009bd0fbf2f1"; + }; + } ]; }; themes = { @@ -201,4 +236,10 @@ }; }; }; + xdg.configFile = { + "helix/runtime/queries/templ/highlights.scm".text = query "highlights"; + "helix/runtime/queries/templ/indents.scm".text = query "indents"; + "helix/runtime/queries/templ/injections.scm".text = query "injections"; + "helix/runtime/queries/templ/structure.scm".text = query "structure"; + }; } diff --git a/flake.lock b/flake.lock index c3f8e11..80925ab 100644 --- a/flake.lock +++ b/flake.lock @@ -115,11 +115,11 @@ ] }, "locked": { - "lastModified": 1694718292, - "narHash": "sha256-x74EG3+M2dz3Kto/KqMov+0/ieShlz/lIoJPQuuhLeM=", + "lastModified": 1694739610, + "narHash": "sha256-8uaewp23kpGZtCF2vjuZR0QJRC0iXC6nyoxI/+7s6sg=", "ref": "refs/heads/main", - "rev": "cf69cfa8319211e017e1017f6374a3c28629c3a7", - "revCount": 164, + "rev": "337275b6dd4514ee7dd0dd0858dccbdbca7853c2", + "revCount": 166, "type": "git", "url": "https://git.jojodev.com/jolheiser/nur" },