Skip to content

Commit b6f986d

Browse files
committed
fix(sketch): handle empty and newline inputs in SketchInputListener
- Trim user input once and reuse it for checks and processing. - Add explicit check for newline input to prevent unnecessary processing. - Update compiled input to use trimmed input for consistency.
1 parent d22f0d3 commit b6f986d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/SketchInputListener.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.intellij.openapi.Disposable
1515
import com.intellij.openapi.application.ApplicationManager
1616
import com.intellij.openapi.application.invokeLater
1717
import com.intellij.openapi.application.runReadAction
18+
import com.intellij.openapi.diagnostic.logger
1819
import com.intellij.openapi.project.Project
1920
import kotlinx.coroutines.cancel
2021
import kotlinx.coroutines.flow.cancellable
@@ -61,6 +62,11 @@ open class SketchInputListener(
6162
if (input.isEmpty() || input.isBlank()) return
6263
if (input == "\n") return
6364

65+
// if length < 10, logger for debug
66+
if (input.length < 10) {
67+
logger<SketchInputListener>().debug("Input.length < 10: $input")
68+
}
69+
6470
ApplicationManager.getApplication().invokeLater {
6571
val devInProcessor = LanguageProcessor.devin()
6672
val compiledInput = runReadAction { devInProcessor?.compile(project, input) } ?: input

0 commit comments

Comments
 (0)