Simplified code
This commit is contained in:
+3
-18
@@ -124,24 +124,9 @@ fun createKeywordConstructLookupElement(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun detectIndent(text: CharSequence, offset: Int): String {
|
private fun detectIndent(text: CharSequence, offset: Int): String {
|
||||||
var index = offset - 1
|
return text.substring(0, offset)
|
||||||
while (index >= 0) {
|
.substringAfterLast('\n')
|
||||||
val c = text[index]
|
.takeWhile { it.isWhitespace() }
|
||||||
if (c == '\n' || c == '\r') {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
index--
|
|
||||||
}
|
|
||||||
index++
|
|
||||||
|
|
||||||
return buildString {
|
|
||||||
while (index < offset) {
|
|
||||||
val c = text[index]
|
|
||||||
if (!c.isWhitespace()) break
|
|
||||||
append(c)
|
|
||||||
index++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.indentLinesAfterFirst(indent: String): String {
|
private fun String.indentLinesAfterFirst(indent: String): String {
|
||||||
|
|||||||
Reference in New Issue
Block a user