Skip to content

Commit a8b11fa

Browse files
committed
refactor(quick-assistant): include language in generated code snippet prompt
1 parent 2685135 commit a8b11fa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/actions/quick/QuickAssistantAction.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,13 @@ open class QuickAssistantAction : AnAction() {
116116

117117
val actionMap = component.actionMap
118118

119+
val language = element?.language?.displayName ?: ""
120+
119121
actionMap.put(QUICK_ASSISTANT_SUBMIT_ACTION, object : AbstractAction() {
120122
override fun actionPerformed(e: ActionEvent?) {
121123
val text =
122-
"""Generate a concise code snippet with no extra text, description, or comments.
123-
|The code should achieve the following task: ${component.getText()}"""
124+
"""Generate a concise $language code snippet with no extra text, description, or comments.
125+
| The code should achieve the following task: ${component.getText()}"""
124126
.trimMargin()
125127

126128
val offset = editor.caretModel.offset

0 commit comments

Comments
 (0)