@@ -60,7 +60,7 @@ open class CodeHighlightSketch(
60
60
private var isDevIns = false
61
61
private var collapsedPanel: JPanel ? = null
62
62
private var previewLabel: JBLabel ? = null // 存储预览标签的引用
63
- private var isCollapsed = true // 默认折叠状态
63
+ private var isCollapsed = true
64
64
private var actionButton: ActionButton ? = null
65
65
private var isComplete = isUser
66
66
private var hasProcessedDevInCommands = false
@@ -115,12 +115,10 @@ open class CodeHighlightSketch(
115
115
editorFragment = EditorFragment (editor, editorLineThreshold, previewEditor)
116
116
}
117
117
118
- // 检查是否需要折叠视图
119
118
val needsCollapsedView = shouldUseCollapsedView()
120
119
if (needsCollapsedView) {
121
120
setupCollapsedView(text)
122
121
} else {
123
- // 直接添加编辑器内容,不使用折叠
124
122
add(editorFragment!! .getContent())
125
123
isCollapsed = false
126
124
}
@@ -229,7 +227,6 @@ open class CodeHighlightSketch(
229
227
actionButtonPresentation.icon = AllIcons .General .ArrowRight
230
228
return ActionButton (
231
229
DumbAwareAction .create {
232
- // 普通编辑器的按钮行为,可以根据需要扩展
233
230
},
234
231
actionButtonPresentation,
235
232
" AutoDevToolbar" ,
@@ -323,7 +320,6 @@ open class CodeHighlightSketch(
323
320
override fun updateViewText (text : String , complete : Boolean ) {
324
321
isComplete = complete
325
322
326
- // Initialize editor if not already done and text is not empty
327
323
if (! hasSetupAction && text.trim().isNotEmpty()) {
328
324
initEditor(text)
329
325
}
@@ -339,8 +335,6 @@ open class CodeHighlightSketch(
339
335
val normalizedText = StringUtil .convertLineSeparators(text)
340
336
try {
341
337
document?.replaceString(0 , document.textLength, normalizedText)
342
-
343
- // Update collapsed panel preview text if applicable
344
338
if (previewLabel != null && shouldUseCollapsedView()) {
345
339
val firstLine = normalizedText.lines().firstOrNull() ? : " "
346
340
previewLabel!! .text = firstLine
@@ -349,22 +343,18 @@ open class CodeHighlightSketch(
349
343
logger<CodeHighlightSketch >().error(" Error updating editor text" , e)
350
344
}
351
345
352
- // Update action button icon state
353
346
updateActionButtonIcon()
354
347
355
348
val lineCount = document?.lineCount ? : 0
356
349
if (lineCount > editorLineThreshold) {
357
350
editorFragment?.updateExpandCollapseLabel()
358
351
}
359
352
360
- // Auto-collapse view when complete (only for collapsible views)
361
- // 注意:现在 shouldUseCollapsedView() 已经考虑了 isUser 和 isDevIns 状态
362
353
if (complete && ! isCollapsed && shouldUseCollapsedView()) {
363
354
toggleEditorVisibility()
364
355
}
365
356
}
366
357
367
- // Process DevIn commands when complete (only once)
368
358
if (complete && ! isUser && ideaLanguage?.displayName == " DevIn" ) {
369
359
processDevInCommands(text)
370
360
hasProcessedDevInCommands = true
0 commit comments