Skip to content

Commit d92a973

Browse files
Merge pull request #330 from juergenhoetzel/indentation-of-first-line-after-bracket
Fix indentation of first line after bracket
2 parents bf7a11e + bb32718 commit d92a973

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

fsharp-mode-structure.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,10 @@ dedenting."
766766
(open-bracket-pos (fsharp-nesting-level)))
767767

768768
(cond
769+
((and open-bracket-pos (eq (and (looking-back "[[:space:]\n\r]+" nil t)
770+
(match-beginning 0))
771+
(1+ open-bracket-pos)))
772+
fsharp-indent-offset)
769773
;; Continuation Lines
770774
((fsharp-continuation-line-p)
771775
(if open-bracket-pos

test/fsharp-mode-structure-tests.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,11 @@
271271
(should (eq (fsharp--compute-indentation-relative-to-previous t) 4))
272272
(should (eq (fsharp--compute-indentation-relative-to-previous t)
273273
(fsharp-compute-indentation t))))))
274+
275+
(describe "The `fsharp-compute-indentation'"
276+
:var ((file (concat fsharp-struct-test-files-dir "BracketIndent.fs")))
277+
(it "indents on the first line after opening bracket"
278+
(with-current-buffer (find-file-noselect file)
279+
(goto-char (point-min))
280+
(search-forward-regexp "let formatTwo = \\[\n")
281+
(should (eq (fsharp-compute-indentation t) fsharp-indent-offset)))))

0 commit comments

Comments
 (0)