Skip to content

Commit ba74e75

Browse files
committed
add a comment about the parent if token call
1 parent b039283 commit ba74e75

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

elixir-smie.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,16 @@
368368
(t (smie-rule-parent elixir-smie-indent-basic))))))
369369
(`(:before . ";")
370370
(cond
371+
;; There is a case after an one line definition of functions/macros
372+
;; when an `if' keyword token is involved, where the next block `end'
373+
;; token will have a `if' as parent and it's hanging.
374+
;;
375+
;; Example:
376+
;;
377+
;; defmacro my_if(expr, do: if_block), do: if(expr, do: if_block, else: nil)
378+
;; defmacro my_if(expr, do: if_block, else: else_block) do
379+
;; ...
380+
;; end <- parent is `if`
371381
((and (smie-rule-parent-p "if")
372382
(smie-rule-hanging-p))
373383
(smie-rule-parent))

0 commit comments

Comments
 (0)