[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/kotlin-mode e5c6d845e6 093/162: Merge pull request #19 fro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/kotlin-mode e5c6d845e6 093/162: Merge pull request #19 from gregghz/fixes-closing-bracket-indentation |
Date: |
Sat, 29 Jan 2022 08:25:26 -0500 (EST) |
branch: elpa/kotlin-mode
commit e5c6d845e689ed0623b864ff863cc99ca558b442
Merge: 9e2e4c11fe ad16798e02
Author: Gregg Hernandez <greggory.hz@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #19 from gregghz/fixes-closing-bracket-indentation
Set proper indentation for closing brackets preceded by a blank line
---
kotlin-mode.el | 23 +++++++++++++----------
test/sample.kt | 14 ++++++++++----
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/kotlin-mode.el b/kotlin-mode.el
index 006379cc31..4cc3dc9ad5 100644
--- a/kotlin-mode.el
+++ b/kotlin-mode.el
@@ -241,7 +241,7 @@
(progn
(kotlin-mode--beginning-of-buffer-indent))
(let ((not-indented t) cur-indent)
- (cond ((looking-at "^[ \t]*\\.")
+ (cond ((looking-at "^[ \t]*\\.") ; line starts with .
(save-excursion
(kotlin-mode--prev-line)
(cond ((looking-at "^[ \t]*\\.")
@@ -252,16 +252,19 @@
(if (< cur-indent 0)
(setq cur-indent 0))))
- ((looking-at "^[ \t]*}")
+ ((looking-at "^[ \t]*}") ; line starts with }
(save-excursion
(kotlin-mode--prev-line)
- (while (and (looking-at "^[ \t]*\\.") (not (bobp)))
+ (while (and (or (looking-at "^[ \t]*$") (looking-at "^[
\t]*\\.")) (not (bobp)))
(kotlin-mode--prev-line))
- (setq cur-indent (- (current-indentation) kotlin-tab-width)))
+ (cond ((or (looking-at ".*{[ \t]*$") (looking-at ".*{.*->[
\t]*$"))
+ (setq cur-indent (current-indentation)))
+ (t
+ (setq cur-indent (- (current-indentation)
kotlin-tab-width)))))
(if (< cur-indent 0)
(setq cur-indent 0)))
- ((looking-at "^[ \t]*)")
+ ((looking-at "^[ \t]*)") ; line starts with )
(save-excursion
(kotlin-mode--prev-line)
(setq cur-indent (- (current-indentation) (* 2
kotlin-tab-width))))
@@ -272,23 +275,23 @@
(save-excursion
(while not-indented
(kotlin-mode--prev-line)
- (cond ((looking-at ".*{[ \t]*$") ; 4.)
+ (cond ((looking-at ".*{[ \t]*$") ; line ends with {
(setq cur-indent (+ (current-indentation)
kotlin-tab-width))
(setq not-indented nil))
- ((looking-at "^[ \t]*}") ; 3.)
+ ((looking-at "^[ \t]*}") ; line starts with }
(setq cur-indent (current-indentation))
(setq not-indented nil))
- ((looking-at ".*{.*->[ \t]*$")
+ ((looking-at ".*{.*->[ \t]*$") ; line ends with ->
(setq cur-indent (+ (current-indentation)
kotlin-tab-width))
(setq not-indented nil))
- ((looking-at ".*([ \t]*$")
+ ((looking-at ".*([ \t]*$") ; line ends with (
(setq cur-indent (+ (current-indentation) (* 2
kotlin-tab-width)))
(setq not-indented nil))
- ((looking-at "^[ \t]*).*$")
+ ((looking-at "^[ \t]*).*$") ; line starts with )
(setq cur-indent (current-indentation))
(setq not-indented nil))
diff --git a/test/sample.kt b/test/sample.kt
index 1768f0142e..c64907fd47 100644
--- a/test/sample.kt
+++ b/test/sample.kt
@@ -7,7 +7,7 @@ import bar.Bar as bBar
// a single line comment
/*
- * a multiline comment
+* a multiline comment
*/
fun sum(a: Int, b: Int): Int {
@@ -273,10 +273,10 @@ class Derived(p: Int) : Base(p)
class MyView : View {
constructor(ctx: Context) : super(ctx) {
-}
+ }
-constructor(ctx: Context, attrs: AttributeSet) : super(ctx, attrs) {
-}
+ constructor(ctx: Context, attrs: AttributeSet) : super(ctx, attrs) {
+ }
}
open class Base {
@@ -705,3 +705,9 @@ inline fun <reified T> TreeNode.findParentOfType(): T? {
}
return p as T
}
+
+class Test {
+ fun f() {
+
+ }
+}
\ No newline at end of file
- [nongnu] elpa/kotlin-mode 52c8099b45 078/162: Merge pull request #1 from taktoa/master, (continued)
- [nongnu] elpa/kotlin-mode 52c8099b45 078/162: Merge pull request #1 from taktoa/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode afbf3ae8fe 081/162: Merge branch 'master' of https://github.com/gregghz/kotlin-mode into gregghz-master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode cd4901acc6 080/162: Merge pull request #6 from jasonm23/patch-1, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode f54da34b3f 088/162: Merge pull request #11 from russel/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode c051947e27 041/162: kotlin-mode: Highlight string interpolations, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode a659099864 037/162: kotlin-mode: Add kotlin-mode--syntax-propertize-interpolation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode c40557c411 053/162: Merge pull request #1 from gergoerdi/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 2f3d991159 060/162: Remove redundant declaration of hook and keymap, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 953bb91328 151/162: Merge pull request #50 from taku0/fix-comment-at-bob, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ab61099682 152/162: use 4 for defualt tab width, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode e5c6d845e6 093/162: Merge pull request #19 from gregghz/fixes-closing-bracket-indentation,
ELPA Syncer <=
- [nongnu] elpa/kotlin-mode 72a2bf2347 096/162: Add a file to get Travis-CI to run the test suite., ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b91bab57b6 099/162: Adding REPL support, credit to https://github.com/sarvex/kotlin-mode, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 1ed0c5589e 098/162: Merge pull request #22 from russel/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 8574583b30 105/162: Fix highlighting escaped identifiers in interpolations, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode eb3704e0e2 106/162: Set adaptive-fill-regexp to comment-start-skip, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 77d709ab54 107/162: Merge pull request #30 from CyberShadow/pull-20180624-142858, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode f08724b978 115/162: Improve handling of bracket-based indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 9fa0d75997 119/162: Tidy up bracked-based indentation into a class, and fix bugs, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 76921927de 117/162: Add a test for correct indentation of sample.kt, and get it to pass (with a few tweaks), ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 511e0a4ee3 121/162: Add in more kotlin keywords and indent get/set methods for properties, ELPA Syncer, 2022/01/29