[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/smartparens 1ebf53b 1/4: Scala wrap indented region correc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/smartparens 1ebf53b 1/4: Scala wrap indented region correctly |
Date: |
Mon, 1 Nov 2021 06:58:03 -0400 (EDT) |
branch: elpa/smartparens
commit 1ebf53be3d757b128676bae1ebecf27cbd249b32
Author: Josef Vlach <vlach.josef@gmail.com>
Commit: Josef Vlach <vlach.josef@gmail.com>
Scala wrap indented region correctly
---
smartparens-scala.el | 1 +
test/smartparens-scala-test.el | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/smartparens-scala.el b/smartparens-scala.el
index 7b37472..96f8c7e 100644
--- a/smartparens-scala.el
+++ b/smartparens-scala.el
@@ -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))
diff --git a/test/smartparens-scala-test.el b/test/smartparens-scala-test.el
index 5c669f5..51ba7cc 100644
--- a/test/smartparens-scala-test.el
+++ b/test/smartparens-scala-test.el
@@ -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|"