@@ -4,16 +4,18 @@ import cc.unitmesh.devti.agent.model.CustomAgentConfig
4
4
import cc.unitmesh.devti.custom.compile.CustomVariable
5
5
import cc.unitmesh.devti.language.completion.dataprovider.BuiltinCommand
6
6
import cc.unitmesh.devti.language.psi.DevInTypes
7
+ import cc.unitmesh.devti.util.parser.convertMarkdownToHtml
7
8
import com.intellij.lang.documentation.AbstractDocumentationProvider
8
9
import com.intellij.openapi.editor.Editor
9
10
import com.intellij.psi.PsiElement
10
11
import com.intellij.psi.PsiFile
11
12
import com.intellij.psi.util.elementType
13
+ import org.intellij.markdown.parser.MarkdownParser
12
14
13
15
class DevInsDocumentationProvider : AbstractDocumentationProvider () {
14
16
override fun generateDoc (element : PsiElement ? , originalElement : PsiElement ? ): String? {
15
17
val project = element?.project ? : return null
16
- return when (element.elementType) {
18
+ val markdownDoc = when (element.elementType) {
17
19
DevInTypes .AGENT_ID -> {
18
20
val agentConfigs = CustomAgentConfig .loadFromProject(project).filter {
19
21
it.name == element.text
@@ -26,7 +28,7 @@ class DevInsDocumentationProvider : AbstractDocumentationProvider() {
26
28
DevInTypes .COMMAND_ID -> {
27
29
val command = BuiltinCommand .all().find { it.commandName == element.text } ? : return null
28
30
val example = BuiltinCommand .example(command)
29
- " ${command.description} \n\ n Example:\n ```devin\n $example \n ```\n "
31
+ " ${command.description} \n Example:\n ```devin\n $example \n ```\n "
30
32
}
31
33
32
34
DevInTypes .VARIABLE_ID -> {
@@ -37,6 +39,8 @@ class DevInsDocumentationProvider : AbstractDocumentationProvider() {
37
39
element.text
38
40
}
39
41
}
42
+
43
+ return convertMarkdownToHtml(markdownDoc ? : " " )
40
44
}
41
45
42
46
override fun getCustomDocumentationElement (
0 commit comments