emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/kotlin-mode 511e0a4ee3 121/162: Add in more kotlin keyword


From: ELPA Syncer
Subject: [nongnu] elpa/kotlin-mode 511e0a4ee3 121/162: Add in more kotlin keywords and indent get/set methods for properties
Date: Sat, 29 Jan 2022 08:25:29 -0500 (EST)

branch: elpa/kotlin-mode
commit 511e0a4ee3dd536411df282e58a81c5e14851d47
Author: Martin Blake <martinblake@github.com>
Commit: Martin Blake <martinblake@github.com>

    Add in more kotlin keywords and indent get/set methods for properties
---
 kotlin-mode.el | 16 ++++++++--------
 test/sample.kt | 22 +++++++++++-----------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/kotlin-mode.el b/kotlin-mode.el
index 61d7ac643e..5ff46bfe28 100644
--- a/kotlin-mode.el
+++ b/kotlin-mode.el
@@ -172,7 +172,7 @@
     "when" "is" "in" "as" "return"))
 
 (defconst kotlin-mode--context-variables-keywords
-  '("this" "super"))
+  '("field" "it" "this" "super"))
 
 (defvar kotlin-mode--keywords
   (append kotlin-mode--misc-keywords
@@ -192,7 +192,7 @@
     "annotation" "internal" "const" "in" "out")) ;; "in" "out"
 
 (defconst kotlin-mode--property-keywords
-  '("by")) ;; "by" "get" "set"
+  '("by" "get" "set")) ;; "by" "get" "set"
 
 (defconst kotlin-mode--initializer-keywords
   '("init" "constructor"))
@@ -256,11 +256,11 @@
 
     ;; Properties
     ;; by/get/set are valid identifiers being used as variable
-    ;; TODO: Highlight keywords in the property declaration statement
-    ;; (,(rx-to-string
-    ;;    `(and bow (group (or ,@kotlin-mode--property-keywords)) eow)
-    ;;    t)
-    ;;  1 font-lock-keyword-face)
+    ;; TODO: Highlight only within the property declaration statement
+    (,(rx-to-string
+       `(and bow (group (or ,@kotlin-mode--property-keywords)) eow)
+       t)
+     1 font-lock-keyword-face)
 
     ;; Constructor/Initializer blocks
     (,(rx-to-string
@@ -344,7 +344,7 @@
 (defun kotlin-mode--line-continuation()
   "Return whether this line continues a statement in the previous line"
   (or
-   (kotlin-mode--line-begins "\\([\.=:]\\|->\\)")
+   (kotlin-mode--line-begins "\\([\.=:]\\|->\\|[sg]et\\b\\)")
    (save-excursion
      (kotlin-mode--prev-line)
      (kotlin-mode--line-ends "\\([=:]\\|->\\)"))))
diff --git a/test/sample.kt b/test/sample.kt
index 2c01e0ed6d..06a8063dfc 100644
--- a/test/sample.kt
+++ b/test/sample.kt
@@ -356,10 +356,10 @@ fun eval(expr: Expr): Double = when(expr) {
 }
 
 var stringRepresentation: String
-get() = this.toString()
-set(value) {
-    setDataFromString(value) // parses the string and assigns values to other 
properties
-}
+    get() = this.toString()
+    set(value) {
+        setDataFromString(value) // parses the string and assigns values to 
other properties
+    }
 
 var setterVisibility: String = "abc"
 private set // the setter is private and has the default implementation
@@ -368,13 +368,13 @@ var setterWithAnnotation: Any? = null
 @Inject set // annotate the setter with Inject
 
 var counter = 0 // the initializer value is written directly to the backing 
field
-set(value) {
-    if (value >= 0)
-    field = value
-}
+    set(value) {
+        if (value >= 0)
+        field = value
+    }
 
 val isEmpty: Boolean
-get() = this.size == 0
+    get() = this.size == 0
 
 const val SUBSYSTEM_DEPRECATED: String = "This subsystem is deprecated"
 
@@ -409,7 +409,7 @@ interface MyInterface {
     val property: Int // abstract
 
     val propertyWithImplementation: String
-    get() = "foo"
+        get() = "foo"
 
     fun foo() {
         print(property)
@@ -479,7 +479,7 @@ fun Any?.toString(): String {
 }
 
 val <T> List<T>.lastIndex: Int
-get() = size - 1
+    get() = size - 1
 
 class MyClass {
     companion object { }  // will be called "Companion"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]