Skip to content

Commit 3d2105b

Browse files
committed
refactor(devins-lang): refactor reorg conversation #100
Refactored `MessageCodeBlockCharProcessor` to improve readability and maintainability by moving constants to instance fields and adding additional checks for context changes. In `DevInsProcessProcessor`, removed the `createTempTaskFile` function as it was not being used and replaced it with a TODO comment to indicate that functionality needs to be implemented in the future.
1 parent a10256f commit 3d2105b

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/run/flow/DevInsProcessProcessor.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,4 @@ class DevInsProcessProcessor(val project: Project) {
103103
fun createAgentTasks(): List<DevInFile> {
104104
TODO()
105105
}
106-
107-
/**
108-
* Generate DevIns Task file by LLM
109-
*/
110-
fun createTempTaskFile(): DevInFile {
111-
// TODO
112-
return DevInFile.fromString(project, "")
113-
}
114106
}

src/main/kotlin/com/intellij/temporary/gui/block/MessageCodeBlockCharProcessor.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ class Parameters(val char: Char, val charIndex: Int, val fullMessage: String)
1010
class ContextChange(@JvmField val contextType: MessageBlockType, @JvmField val borderType: BorderType)
1111

1212
class MessageCodeBlockCharProcessor {
13-
companion object {
14-
const val triggerChar: Char = '`'
15-
const val borderBlock: String = "```"
16-
}
13+
private val triggerChar: Char = '`'
14+
private val borderBlock: String = "```"
1715

1816
fun suggestTypeChange(
1917
parameters: Parameters,
@@ -52,10 +50,12 @@ class MessageCodeBlockCharProcessor {
5250
val subSequence = fullMessage.subSequence(charIndex - 3, charIndex + 1)
5351
subSequence == "\n$borderBlock"
5452
}
53+
5554
parameters.char == '\n' && (charIndex - 3) - 1 >= 0 -> {
5655
val subSequence = fullMessage.subSequence(charIndex - 4, charIndex)
5756
subSequence == "\n$borderBlock"
5857
}
58+
5959
else -> false
6060
}
6161
}

0 commit comments

Comments
 (0)