generated from JetBrains/intellij-platform-plugin-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
29 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 16 additions & 3 deletions
19
java/src/main/kotlin/cc/unitmesh/idea/provider/JavaTestDataBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
package cc.unitmesh.idea.provider | ||
|
||
import cc.unitmesh.devti.provider.TestDataBuilder | ||
import cc.unitmesh.idea.context.JavaContextCollection | ||
import com.intellij.psi.PsiClassType | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.PsiMethod | ||
|
||
class JavaTestDataBuilder : TestDataBuilder { | ||
override fun inBoundData(element: PsiElement): Pair<String, String>? { | ||
if (element !is PsiMethod) return null | ||
override fun outBoundData(element: PsiElement): Map<String, String> { | ||
if (element !is PsiMethod) return emptyMap() | ||
|
||
return null | ||
val returnType = element.returnType ?: return emptyMap() | ||
when { | ||
returnType is PsiClassType -> { | ||
returnType.resolve()?.let { | ||
val qualifiedName = it.qualifiedName!! | ||
val simpleClassStructure = JavaContextCollection.dataStructure(it) | ||
return mapOf(qualifiedName to simpleClassStructure.toString()) | ||
} | ||
} | ||
} | ||
|
||
return emptyMap() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters