Better tooltip for try
This commit is contained in:
@@ -290,7 +290,24 @@ class KotlinBreadcrumbsInfoProvider : BreadcrumbsInfoProvider() {
|
||||
override fun accepts(element: KtBlockExpression) = element.parent is KtTryExpression
|
||||
|
||||
override fun elementInfo(element: KtBlockExpression) = "try"
|
||||
override fun elementTooltip(element: KtBlockExpression) = "try"
|
||||
|
||||
override fun elementTooltip(element: KtBlockExpression): String {
|
||||
return buildString {
|
||||
val tryExpression = element.parent as KtTryExpression
|
||||
|
||||
append("try {$ellipsis}")
|
||||
|
||||
for (catchClause in tryExpression.catchClauses) {
|
||||
append("\ncatch(")
|
||||
append(catchClause.catchParameter?.typeReference?.text ?: "")
|
||||
append(") {$ellipsis}")
|
||||
}
|
||||
|
||||
if (tryExpression.finallyBlock != null) {
|
||||
append("\nfinally {$ellipsis}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private object CatchHandler : ElementHandler<KtCatchClause>(KtCatchClause::class) {
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ Crumbs:
|
||||
catch (RuntimeException)
|
||||
Tooltips:
|
||||
function <b><code>foo()</code></b>
|
||||
try
|
||||
try {…}
|
||||
catch(Exception) {…}
|
||||
finally
|
||||
catch (RuntimeException)
|
||||
Reference in New Issue
Block a user