Skip to content

Commit b827d96

Browse files
committed
refactor(parser): simplify DevIn code fence filtering logic
Streamline the filtering logic for DevIn code fences by explicitly checking the origin language and text content, improving readability and maintainability.
1 parent fa7ce60 commit b827d96

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/code/CodeHighlightSketch.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.unitmesh.devti.sketch.ui.code
22

3+
import cc.unitmesh.devti.AutoDevBundle
34
import cc.unitmesh.devti.AutoDevNotifications
45
import cc.unitmesh.devti.AutoDevSnippetFile
56
import cc.unitmesh.devti.devin.dataprovider.BuiltinCommand
@@ -162,6 +163,8 @@ open class CodeHighlightSketch(
162163
add(sketch, BorderLayout.SOUTH)
163164
return
164165
}
166+
167+
return
165168
}
166169

167170
val codes = CodeFence.parseAll(editorFragment!!.editor.document.text)
@@ -333,7 +336,7 @@ open class CodeHighlightSketch(
333336
* Add Write Command Action
334337
*/
335338
private fun CodeHighlightSketch.processWriteCommand(currentText: String) {
336-
val button = JButton("Write to file", AllIcons.Actions.MenuSaveall).apply {
339+
val button = JButton(AutoDevBundle.message("sketch.write.to.file"), AllIcons.Actions.MenuSaveall).apply {
337340
preferredSize = JBUI.size(120, 30)
338341

339342
addActionListener {

core/src/main/resources/genius/zh/code/sketch.vm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ Index: src/main/index.html
145145
```http
146146
// the http code
147147
```
148-
启动应用程序
148+
149+
启动应用程序
150+
149151
```bash
150152
./gradlew :bootRun
151153
```

core/src/main/resources/messages/AutoDevBundle_en.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,4 @@ sketch.plan.finish.task=Please help me finish task:
163163
sketch.plan.review=AI re-evaluate Sketch plan
164164
sketch.plan.edit=Edit Plan
165165
sketch.plan.reviewing=Reviewing Plan
166+
sketch.write.to.file=Write to file

core/src/main/resources/messages/AutoDevBundle_zh.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,4 @@ sketch.plan.finish.task=请帮我完成以下任务:
163163
sketch.plan.review=AI 重新评估 Sketch 计划
164164
sketch.plan.edit=添加/编辑计划
165165
sketch.plan.reviewing=Reviewing Plan
166+
sketch.write.to.file=写入文件

0 commit comments

Comments
 (0)