Skip to content

Commit 64ca055

Browse files
committed
Correct indentation after binary sequence
1 parent 480d5a3 commit 64ca055

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

elixir-smie.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@
144144
(rx (or "<<<" ">>>" "^^^" "~~~" "&&&" "|||" "===" "!==" "==" "!=" "<="
145145
"=" ">=" "<" ">" "&&" "||" "<>" "++" "--" "//" "/>" "=~" "|>")))
146146

147+
(defvar elixir-smie--binary-sequence-regexp
148+
(rx (or "<<" ">>")))
149+
147150
(defvar elixir-smie--block-operator-regexp
148151
(rx "->" (0+ nonl)))
149152

@@ -241,6 +244,9 @@
241244
((looking-back elixir-smie--block-operator-regexp (- (point) 3) t)
242245
(goto-char (match-beginning 0))
243246
"->")
247+
((looking-back elixir-smie--binary-sequence-regexp (- (point) 3) t)
248+
(goto-char (match-beginning 0))
249+
"OP")
244250
((looking-back elixir-smie--operator-regexp (- (point) 3) t)
245251
(goto-char (match-beginning 0))
246252
"OP")

test/elixir-mode-indentation-test.el

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,25 @@ defmodule Greeter do
850850
end
851851
end")
852852

853+
(elixir-def-indentation-test indent-binary-sequence
854+
(:tags '(indentation))
855+
"
856+
defmodule ExampleTest do
857+
test \"the truth\" do
858+
assert <<1,2>> == <<1,2>>
859+
assert 1 + 1 == 2
860+
end
861+
end"
862+
863+
"
864+
defmodule ExampleTest do
865+
test \"the truth\" do
866+
assert <<1,2>> == <<1,2>>
867+
assert 1 + 1 == 2
868+
end
869+
end")
870+
871+
853872
;; We don't want automatic whitespace cleanup here because of the significant
854873
;; whitespace after `Record' above. By setting `whitespace-action' to nil,
855874
;; `whitespace-mode' won't automatically clean up trailing whitespace (in my

0 commit comments

Comments
 (0)