Skip to content

Commit 2c7f5e7

Browse files
jbodahkelvinst
authored andcommitted
try else indent (elixir-editors#462)
* add failing try/else spec * add indent rules for try/else
1 parent 1be5338 commit 2c7f5e7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

autoload/elixir/indent.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function! elixir#indent#handle_inside_block(context)
265265
let config = {
266266
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
267267
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
268-
\'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after'), 'pattern_match_clauses': s:keyword('catch\|rescue')},
268+
\'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after\|else'), 'pattern_match_clauses': s:keyword('catch\|rescue\|else')},
269269
\'r': {'aligned_clauses': s:keyword('end\|after'), 'pattern_match_clauses': s:keyword('after')},
270270
\'i': {'aligned_clauses': s:keyword('end\|else'), 'pattern_match_clauses': never_match},
271271
\'[': {'aligned_clauses': ']', 'pattern_match_clauses': never_match},

spec/indent/try_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@
3030
end
3131
end
3232
EOF
33+
34+
i <<~EOF
35+
try do
36+
foo()
37+
else
38+
value -> value
39+
end
40+
EOF
3341
end

0 commit comments

Comments
 (0)