Fix for KT-12872 Don't show "defined in <very long qualifier here>" in quick doc for local variables
#KT-12872 fixed
This commit is contained in:
committed by
Simon Ogorodnik
parent
d89afc419d
commit
fa01a4efad
@@ -48,6 +48,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||
import org.jetbrains.kotlin.renderer.ClassifierNamePolicy
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.deprecatedByAnnotationReplaceWithExpression
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
||||
import org.jetbrains.kotlin.resolve.getDeprecations
|
||||
@@ -163,7 +164,9 @@ class KotlinQuickDocumentationProvider : AbstractDocumentationProvider() {
|
||||
}
|
||||
}
|
||||
|
||||
var renderedDecl = DESCRIPTOR_RENDERER.render(declarationDescriptor)
|
||||
var renderedDecl = DESCRIPTOR_RENDERER.withOptions {
|
||||
withDefinedIn = !DescriptorUtils.isLocal(declarationDescriptor)
|
||||
}.render(declarationDescriptor)
|
||||
|
||||
if (!quickNavigation) {
|
||||
renderedDecl = "<pre>$renderedDecl</pre>"
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
fun some(<caret>f: (Int) -> String) : String? = null
|
||||
|
||||
//INFO: <pre><b>value-parameter</b> f: (Int) → String <i>defined in</i> some</pre>
|
||||
//INFO: <pre><b>value-parameter</b> f: (Int) → String</pre>
|
||||
|
||||
@@ -4,4 +4,4 @@ fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
//INFO: <pre><b>value-parameter</b> it: Int <i>defined in</i> foo.<anonymous></pre>
|
||||
//INFO: <pre><b>value-parameter</b> it: Int</pre>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
fun context() {
|
||||
fun local() {
|
||||
|
||||
}
|
||||
|
||||
<caret>local()
|
||||
}
|
||||
|
||||
//INFO: <pre><b>local</b> <b>final</b> <b>fun</b> local(): Unit</pre>
|
||||
+1
-1
@@ -5,4 +5,4 @@ fun test() {
|
||||
}
|
||||
|
||||
|
||||
//INFO: <pre><b>val</b> test: String? <i>defined in</i> test</pre>
|
||||
//INFO: <pre><b>val</b> test: String?</pre>
|
||||
|
||||
+6
@@ -54,6 +54,12 @@ public class QuickDocProviderTestGenerated extends AbstractQuickDocProviderTest
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("AtLocalFunction.kt")
|
||||
public void testAtLocalFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/AtLocalFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("AtTypeParameter.kt")
|
||||
public void testAtTypeParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/AtTypeParameter.kt");
|
||||
|
||||
Reference in New Issue
Block a user