Skip to content
Permalink
Browse files

Don’t skip over > in angle-path

Fixes #94
  • Loading branch information
matthewbauer committed May 10, 2020
1 parent ddf0917 commit 9242165717d15edb8655b77e64e5cb86d7a2c734
Showing with 17 additions and 5 deletions.
  1. +5 −5 nix-mode.el
  2. +6 −0 tests/nix-mode-tests.el
  3. +6 −0 tests/testcases/issue-94.nix
@@ -418,7 +418,7 @@ STRING-TYPE type of string based off of Emacs syntax table types"
(right " -bseqskip- ")
(left " -fseqskip- "))))))

(defconst nix-smie--symbol-chars ":->|&=!</-+*?,;!")
(defconst nix-smie--symbol-chars "[:->|&=!</-+*?,;!]")

(defconst nix-smie--infix-symbols-re
(regexp-opt '(":" "->" "||" "&&" "==" "!=" "<" "<=" ">" ">="
@@ -573,8 +573,8 @@ STRING-TYPE type of string based off of Emacs syntax table types"
(point)
(progn
(or (/= 0 (skip-syntax-forward "'w_"))
(/= 0 (skip-chars-forward nix-smie--symbol-chars))
(skip-syntax-forward ".'"))
(when (looking-at nix-smie--symbol-chars) (forward-char) t)
(skip-syntax-forward "'"))
(point)))))

(defun nix-smie--forward-token ()
@@ -595,8 +595,8 @@ STRING-TYPE type of string based off of Emacs syntax table types"
(point)
(progn
(or (/= 0 (skip-syntax-backward "'w_"))
(/= 0 (skip-chars-backward nix-smie--symbol-chars))
(skip-syntax-backward ".'"))
(when (looking-back nix-smie--symbol-chars) (backward-char) t)
(skip-syntax-backward "'"))
(point)))))

(defun nix-smie--backward-token ()
@@ -227,6 +227,12 @@ Related issue: https://github.com/NixOS/nix-mode/issues/72"
"Proper indentation of strings in a multi-line string."
(with-nix-mode-test ("issue-78.nix" :indent 'smie-indent-line)))

(ert-deftest nix-mode-test-indent-issue-94 ()
"Proper indentation of attrsets inside of lists inside of attrsets.
Related issue: https://github.com/NixOS/nix-mode/issues/94"
(with-nix-mode-test ("issue-60.1.nix" :indent 'smie-indent-line)))

(ert-deftest nix-mode-test-indent-lambdas-smie ()
"Proper indentation of function bodies."
(with-nix-mode-test ("smie-lambdas.nix" :indent 'smie-indent-line)))
@@ -0,0 +1,6 @@
let
nixpkgs = <nixpkgs>;
wrongIndentedLine = true;
in {
a = "b";
}

0 comments on commit 9242165

Please sign in to comment.
You can’t perform that action at this time.