Skip to content

Commit 22ec6fa

Browse files
committed
refactor(core): simplify variable naming in batch file processing
Renamed `vfile` to `file` for consistency and readability. Also, streamlined the error message construction for clarity.
1 parent 9733140 commit 22ec6fa

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

core/src/main/kotlin/cc/unitmesh/devti/custom/TeamPromptBaseIntention.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,27 @@ class TeamPromptBaseIntention(val intentionConfig: TeamPromptAction, val trySele
5252
val actionPrompt = intentionConfig.actionPrompt
5353
val chatMessages = actionPrompt.msgs
5454

55-
5655
if (actionPrompt.batchFileRegex != "") {
5756
val files = actionPrompt.batchFiles(project)
5857
if (files.isNotEmpty()) {
5958
val length = files.size
60-
files.forEachIndexed { index, vfile ->
61-
compiler.set("all", VfsUtilCore.loadText(vfile))
59+
files.forEachIndexed { index, file ->
60+
compiler.set("all", VfsUtilCore.loadText(file))
6261
val msgs = chatMessages.map {
6362
it.copy(content = compiler.compile(it.content))
6463
}
6564

6665
// display progress like 1/2 in the title
67-
val taskName = "${intentionConfig.actionName} ${index + 1}/$length - ${vfile.name}"
66+
val taskName = "${intentionConfig.actionName} ${index + 1}/$length - ${file.name}"
6867
val task: Task.Backgroundable =
69-
TeamPromptExecTask(project, msgs, editor, intentionConfig, element, vfile, taskName)
68+
TeamPromptExecTask(project, msgs, editor, intentionConfig, element, file, taskName)
69+
7070
ProgressManager.getInstance()
7171
.runProcessWithProgressAsynchronously(task, BackgroundableProcessIndicator(task))
7272
}
7373
} else {
74-
AutoDevNotifications.error(
75-
project,
76-
"No files found for batch processing, please check the regex. " + "Regex: ${actionPrompt.batchFileRegex}"
77-
)
74+
val msg = "No files found for batch processing, please check the regex: ${actionPrompt.batchFileRegex}"
75+
AutoDevNotifications.error(project, msg)
7876
}
7977
} else {
8078
val msgs = chatMessages.map {

0 commit comments

Comments
 (0)