[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/kotlin-mode e1540a5ddf 087/162: Merge pull request #10 fro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/kotlin-mode e1540a5ddf 087/162: Merge pull request #10 from gregghz/master |
Date: |
Sat, 29 Jan 2022 08:25:25 -0500 (EST) |
branch: elpa/kotlin-mode
commit e1540a5ddf21667a18e330abd28f07a4c55f999d
Merge: fa8f063a1e c65c96a51a
Author: Gregg Hernandez <greggory.hz@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #10 from gregghz/master
handle chained method calls on multiple lines
---
kotlin-mode.el | 15 ++++++++++++++-
test/kotlin-mode-test.el | 26 ++++++++++++++++++++++++++
test/run-tests.sh | 5 +++++
test/sample.kt | 15 ++++++++++-----
4 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/kotlin-mode.el b/kotlin-mode.el
index 4c748de5f4..4f67c027b3 100644
--- a/kotlin-mode.el
+++ b/kotlin-mode.el
@@ -233,9 +233,22 @@
(progn
(kotlin-mode--beginning-of-buffer-indent))
(let ((not-indented t) cur-indent)
- (cond ((looking-at "^[ \t]*}")
+ (cond ((looking-at "^[ \t]*\\.")
(save-excursion
(forward-line -1)
+ (cond ((looking-at "^[ \t]*\\.")
+ (setq cur-indent (current-indentation)))
+
+ (t
+ (setq cur-indent (+ (current-indentation) (* 2
kotlin-tab-width)))))
+ (if (< cur-indent 0)
+ (setq cur-indent 0))))
+
+ ((looking-at "^[ \t]*}")
+ (save-excursion
+ (forward-line -1)
+ (while (and (looking-at "^[ \t]*\\.") (not (bobp)))
+ (forward-line -1))
(setq cur-indent (- (current-indentation) kotlin-tab-width)))
(if (< cur-indent 0)
(setq cur-indent 0)))
diff --git a/test/kotlin-mode-test.el b/test/kotlin-mode-test.el
index 0ec9a85bbb..c75137cd3b 100644
--- a/test/kotlin-mode-test.el
+++ b/test/kotlin-mode-test.el
@@ -46,3 +46,29 @@ return a + b
(should (equal (buffer-string) "fun sum(a: Int, b: Int): Int {
return a + b
}")))))
+
+;; (ert-deftest kotlin-mode--chained-methods ()
+;; (with-temp-buffer
+;; (let ((text "names.filter { it.empty }
+;; .sortedBy { it }
+;; .map { it.toUpperCase() }
+;; .forEach { print(it) }"))
+
+;; (insert text)
+;; (beginning-of-buffer)
+
+;; (kotlin-mode--indent-line)
+
+;; (next-line)
+;; (kotlin-mode--indent-line)
+
+;; (next-line)
+;; (kotlin-mode--indent-line)
+
+;; (next-line)
+;; (kotlin-mode--indent-line)
+
+;; (should (equal (buffer-string) "names.filter { it.empty }
+;; .sortedBy { it }
+;; .map { it.toUpperCase() }
+;; .forEach { print(it) }")))))
\ No newline at end of file
diff --git a/test/run-tests.sh b/test/run-tests.sh
new file mode 100755
index 0000000000..80faa08d32
--- /dev/null
+++ b/test/run-tests.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+cd ../
+emacs -batch -l ert -l test/kotlin-mode-test.el -f ert-run-tests-batch-and-exit
+cd test
diff --git a/test/sample.kt b/test/sample.kt
index 3edfd5a452..1768f0142e 100644
--- a/test/sample.kt
+++ b/test/sample.kt
@@ -104,11 +104,16 @@ println(name)
if (text in names) // names.contains(text) is called
print("Yes")
-names
-.filter { it.startsWith("A") }
-.sortedBy { it }
-.map { it.toUpperCase() }
-.forEach { print(it) }
+names.filter { it.startsWith("A") }
+ .sortedBy { it }
+ .map { it.toUpperCase() }
+ .forEach { print(it) }
+
+fun f() {
+ things.f()
+ .g()
+ .h()
+}
data class Customer(val name: String, val email: String)
val positives = list.filter { x -> x > 0 }
- [nongnu] elpa/kotlin-mode eb7183e47b 101/162: Merge pull request #25 from tninja/master, (continued)
- [nongnu] elpa/kotlin-mode eb7183e47b 101/162: Merge pull request #25 from tninja/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 0e542ae2f7 114/162: Merge pull request #37 from cjfuller/fix-star-projected-types, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 2467eceee3 118/162: Properly indent multi-line comment blocks, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 3c48b34e0d 127/162: Delete unused function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 1f57bb5a92 135/162: Fix test runner in .travis.yml, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 96b37d211c 139/162: Merge pull request #45 from taku0/add_backup_to_gitignore, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode d9d77ed459 069/162: indentation logic handling lambdas, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 82db4dce0c 077/162: basic indentation test, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 49ef724e96 076/162: additional keywords and smarter highlighting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 257647d5d6 083/162: handle chained method calls on multiple lines, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode e1540a5ddf 087/162: Merge pull request #10 from gregghz/master,
ELPA Syncer <=
- [nongnu] elpa/kotlin-mode ad16798e02 091/162: Set proper indentation for closing brackets preceded by a blank line, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ebcf6f3730 102/162: switch to tab-width, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 1b6d311168 108/162: Merge pull request #31 from jojojames/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 734b08408c 103/162: Add send-{block, buffer, line, region}-and-focus functions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 472ae23d6a 113/162: Fix syntax highlighting of star-projected types, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 002dd1497c 112/162: Merge pull request #36 from mikegolod/issue-35, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ea5f378e40 129/162: Merge pull request #43 from taku0/add-prefix-to-methods, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b4b575ce3a 130/162: Merge pull request #41 from ppareit/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 5dbf5dbf5f 132/162: Add *~ to .gitignore, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode e8100a9070 137/162: Adds more emacs versions to test matrix, ELPA Syncer, 2022/01/29