Skip to content

Commit

Permalink
Scala wrap indented region correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
VlachJosef committed Sep 11, 2021
1 parent 2834c66 commit 1ebf53b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions smartparens-scala.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
(defun sp-scala-wrap-with-indented-newlines (_1 action _2)
"Post handler for the wrap ACTION, putting the region on indented newlines."
(when (eq action 'wrap)
(indent-for-tab-command)
(sp-get sp-last-wrapped-region
(let ((beg :beg-in)
(end :end-in))
Expand Down
7 changes: 7 additions & 0 deletions test/smartparens-scala-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
(execute-kbd-macro "{")
(should (equal (buffer-string) "{\n foo\n}"))))

(ert-deftest sp-test-scala-curly-wrap-indent ()
"Wrap an indented region in an indented block"
(sp-test-with-temp-buffer "if (true)\n |fooM"
(scala-mode)
(execute-kbd-macro "{")
(should (equal (buffer-string) "if (true)\n{\n foo\n}"))))

(ert-deftest sp-test-scala-triple-quotes ()
"Close triple quotes"
(sp-test-with-temp-buffer "sql|"
Expand Down

0 comments on commit 1ebf53b

Please sign in to comment.