Skip to content

Commit 6f0e1e6

Browse files
committed
feat(completion): add icons to builtin commands #101
Add icons to the builtin commands to enhance the user experience in the completion popup. This commit introduces the `AllIcons` imports and assigns an icon to each command, providing a visual cue for users to quickly identify the command they are looking for.
1 parent e004549 commit 6f0e1e6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

exts/devin-lang/src/main/kotlin/cc/unitmesh/devti/language/completion/BuiltinCommandProvider.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package cc.unitmesh.devti.language.completion
33
import cc.unitmesh.devti.language.DevInIcons
44
import com.intellij.codeInsight.completion.*
55
import com.intellij.codeInsight.lookup.LookupElementBuilder
6+
import com.intellij.icons.AllIcons
67
import com.intellij.util.ProcessingContext
8+
import javax.swing.Icon
79

8-
enum class BuiltinCommand(val agentName: String, val description: String) {
9-
FILE("file", "Read the content of a file"),
10-
REV("rev", "Read git change by file"),
11-
SYMBOL("symbol", "Read content by Java/Kotlin canonicalName"),
12-
WRITE("write", "Write content to a file, format: /write:/path/to/file:L1-C2"),
10+
enum class BuiltinCommand(val agentName: String, val description: String, val icon: Icon) {
11+
FILE("file", "Read the content of a file", AllIcons.Actions.AddFile),
12+
REV("rev", "Read git change by file", AllIcons.Vcs.History),
13+
SYMBOL("symbol", "Read content by Java/Kotlin canonicalName", AllIcons.Actions.GroupBy),
14+
WRITE("write", "Write content to a file, /write:/path/to/file:L1-L2", AllIcons.Actions.Edit),
1315
;
1416

1517
companion object {
@@ -32,7 +34,7 @@ class BuiltinCommandProvider : CompletionProvider<CompletionParameters>() {
3234
BuiltinCommand.all().forEach {
3335
result.addElement(
3436
LookupElementBuilder.create(it.agentName)
35-
.withIcon(DevInIcons.DEFAULT)
37+
.withIcon(it.icon)
3638
.withTypeText(it.description, true)
3739
)
3840
}

0 commit comments

Comments
 (0)