mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] Do not display KtScript names
#KTIJ-27680 Fixed GitOrigin-RevId: 35ae20cc764255246fe8364ad7f7e86ed30464ad
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4e3a3ce8e1
commit
63251ee763
+6
-5
@@ -154,10 +154,11 @@ class KotlinBreadcrumbsInfoProvider : BreadcrumbsProvider {
|
||||
|
||||
private object DeclarationHandler : ElementHandler<KtDeclaration>(KtDeclaration::class) {
|
||||
override fun accepts(element: KtDeclaration): Boolean {
|
||||
if (element is KtProperty) {
|
||||
return element.parent is KtFile || element.parent is KtClassBody // do not show local variables
|
||||
return when (element) {
|
||||
is KtProperty -> element.parent is KtFile || element.parent is KtClassBody // do not show local variables
|
||||
is KtScript, is KtScriptInitializer -> false
|
||||
else -> true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun elementInfo(element: KtDeclaration): String {
|
||||
@@ -390,12 +391,12 @@ class KotlinBreadcrumbsInfoProvider : BreadcrumbsProvider {
|
||||
|
||||
override fun getElementInfo(e: PsiElement): String {
|
||||
if (DumbService.isDumb(e.project)) return ""
|
||||
return handler(e)!!.elementInfo(e as KtElement)
|
||||
return handler(e)?.elementInfo(e as KtElement) ?: ""
|
||||
}
|
||||
|
||||
override fun getElementTooltip(e: PsiElement): String {
|
||||
if (DumbService.isDumb(e.project)) return ""
|
||||
return handler(e)!!.elementTooltip(e as KtElement)
|
||||
return handler(e)?.elementTooltip(e as KtElement) ?: ""
|
||||
}
|
||||
|
||||
override fun getParent(element: PsiElement): PsiElement? =
|
||||
|
||||
+5
@@ -73,6 +73,11 @@ public class KotlinFirBreadcrumbsTestGenerated extends AbstractKotlinFirBreadcru
|
||||
runTest("../../idea/tests/testData/codeInsight/breadcrumbs/PropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("script.kts")
|
||||
public void testScript() throws Exception {
|
||||
runTest("../../idea/tests/testData/codeInsight/breadcrumbs/script.kts");
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("../../idea/tests/testData/codeInsight/breadcrumbs/StarProjection.kt");
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ abstract class AbstractBreadcrumbsTest : KotlinLightPlatformCodeInsightFixtureTe
|
||||
|
||||
protected open fun doTest(unused: String) {
|
||||
val fileName = fileName()
|
||||
assert(fileName.endsWith(".kt")) { fileName }
|
||||
assert(fileName.endsWith(".kt") || fileName.endsWith(".kts")) { fileName }
|
||||
myFixture.configureByFile(fileName)
|
||||
|
||||
val element = myFixture.file.findElementAt(myFixture.caretOffset)!!
|
||||
|
||||
+5
@@ -73,6 +73,11 @@ public class BreadcrumbsTestGenerated extends AbstractBreadcrumbsTest {
|
||||
runTest("testData/codeInsight/breadcrumbs/PropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("script.kts")
|
||||
public void testScript() throws Exception {
|
||||
runTest("testData/codeInsight/breadcrumbs/script.kts");
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("testData/codeInsight/breadcrumbs/StarProjection.kt");
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
plugins {
|
||||
<caret>application
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
Crumbs:
|
||||
plugins{…}
|
||||
Tooltips:
|
||||
lambda <b><code>Script.<anonymous>()</code></b>
|
||||
+1
-1
@@ -519,7 +519,7 @@ private fun assembleWorkspace(): TWorkspace = workspace {
|
||||
}
|
||||
|
||||
testClass<AbstractBreadcrumbsTest> {
|
||||
model("codeInsight/breadcrumbs")
|
||||
model("codeInsight/breadcrumbs", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractK1IntentionTest> {
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ internal fun MutableTWorkspace.generateK2CodeInsightTests() {
|
||||
model("../../../idea/tests/testData/codeInsight/surroundWith/withIfElseExpression", testMethodName = "doTestWithSurroundWithIfElseExpression")
|
||||
}
|
||||
testClass<AbstractKotlinFirBreadcrumbsTest> {
|
||||
model("../../../idea/tests/testData/codeInsight/breadcrumbs")
|
||||
model("../../../idea/tests/testData/codeInsight/breadcrumbs", pattern = KT_OR_KTS)
|
||||
}
|
||||
testClass<AbstractKotlinFirUnwrapRemoveTest> {
|
||||
model("../../../idea/tests/testData/codeInsight/unwrapAndRemove/removeExpression", testMethodName = "doTestExpressionRemover")
|
||||
|
||||
Reference in New Issue
Block a user