Skip to content

Commit b431a0a

Browse files
committed
fix: doc for V/T/CV variables
1 parent e5cc749 commit b431a0a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/kotlin/com/github/xepozz/php_opcodes_language/documentation/PHPOpDocumentationProvider.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ class PHPOpDocumentationProvider : AbstractDocumentationProvider() {
2121
override fun generateDoc(element: PsiElement?, originalElement: PsiElement?): String? = when (element) {
2222
is PHPOpParenParameter -> generateDoc(element.parameter, originalElement)
2323
is PHPOpParameter -> {
24-
val directiveName =
25-
if (element.isVariable) element.text.trimEnd { it.isDigit() } else element.text.toString()
24+
val elementName = element.text ?: return null
25+
val directiveName = when {
26+
element.isVariable -> elementName.trimEnd { it.isDigit() }
27+
else -> elementName
28+
}
2629
val doc = OpcodesDictionary.getDocumentation(directiveName) ?: return null
2730

2831
val highlighter = CodeBlockHtmlSyntaxHighlighter(element.project)
2932

3033
buildString {
3134
append("<div class='definition'>")
32-
append("<pre><b>Name</b>: ${doc.name}</pre>")
35+
append("<pre><b>Name</b>: ${elementName}</pre>")
3336
if (doc.number >= 0) {
3437
append("<pre><b>Number</b>: ${doc.number}</pre>")
3538
}

0 commit comments

Comments
 (0)