Skip to content

Commit ebacccd

Browse files
committed
feat(devins-lang): add docs support for built-in command examples #100
1 parent 063463a commit ebacccd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/documentation/DevInsDocumentationProvider.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ class DevInsDocumentationProvider : AbstractDocumentationProvider() {
2424
}
2525

2626
DevInTypes.COMMAND_ID -> {
27-
BuiltinCommand.all().find { it.commandName == element.text }?.description
27+
val command = BuiltinCommand.all().find { it.commandName == element.text } ?: return null
28+
val example = BuiltinCommand.example(command)
29+
"${command.description}\n\nExample:\n```devin\n$example\n```\n"
2830
}
31+
2932
DevInTypes.VARIABLE_ID -> {
3033
CustomVariable.all().find { it.variable == element.text }?.description
3134
}

0 commit comments

Comments
 (0)