Skip to content

Commit

Permalink
highlight "or" as keyword (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
heraplem authored Sep 16, 2024
1 parent 9fa9326 commit 5c04f8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 2 additions & 5 deletions nix-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,8 @@
@font-lock-keyword-face))

;; "or" is technically an operator, but we fontify it as a keyword
((identifier) @font-lock-keyword-face
(:match
,(rx-to-string
`(seq bol "or" eol))
@font-lock-keyword-face)))
(select_expression
("or" @font-lock-keyword-face)))

:language 'nix
:feature 'string
Expand Down
4 changes: 3 additions & 1 deletion test/nix-ts-mode-font-lock-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ let
pkgs = {
test = \"\";
};
a = x.y or z;
in rec {
inherit pkgs;
test = with pkgs; test;
Expand All @@ -87,7 +88,8 @@ in rec {
("inherit" font-lock-keyword-face)
("in" font-lock-keyword-face)
("with" font-lock-keyword-face)
("rec" font-lock-keyword-face))))
("rec" font-lock-keyword-face)
("or" font-lock-keyword-face))))


(ert-deftest nix-ts-error ()
Expand Down

0 comments on commit 5c04f8f

Please sign in to comment.