Scratch: take into account only lines with expressions calculating inlay insert offset

This commit is contained in:
Natalia Selezneva
2018-05-17 13:19:32 +03:00
parent aa7c13e30b
commit db63877690
3 changed files with 6 additions and 6 deletions
@@ -96,10 +96,10 @@ object InlayScratchOutputHandler : ScratchOutputHandler {
private fun maxLineLength(file: ScratchFile): Int {
val doc = file.editor.editor.document
return (0 until doc.lineCount)
return file.getExpressions()
.flatMap { it.lineStart..it.lineEnd }
.map { doc.getLineEndOffset(it) - doc.getLineStartOffset(it) }
.max()
?: -1
.max() ?: 0
}
private fun clearInlays(editor: TextEditor) {
+1 -1
View File
@@ -1,4 +1,4 @@
foo() // ERROR: error: unresolved reference: foo...
foo() // ERROR: error: unresolved reference: foo...
/** unresolved.kts:1 error: unresolved reference: foo
foo()
+2 -2
View File
@@ -1,8 +1,8 @@
foo.forEach { // ERROR: error: unresolved reference: foo...
foo.forEach { // ERROR: error: unresolved reference: foo...
1 + 1
}
fun goo(a: String) { // ERROR: error: unresolved reference: goo...
fun goo(a: String) { // ERROR: error: unresolved reference: goo...
super.goo(a)
}
/** unresolvedMultiline.kts:1 error: unresolved reference: foo