mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-77171 Fails to render quick documentation
GitOrigin-RevId: 02ff0d9d9b08ffc4cac1344cf50b98d57aef920b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bada8a9c0f
commit
4258a66920
+5
-5
@@ -569,7 +569,7 @@ public final class PyDocumentationBuilder {
|
||||
if (myElement instanceof PyTargetExpression && ((PyTargetExpression)myElement).getDocStringValue() == null) {
|
||||
final PyExpression assignedValue = ((PyTargetExpression)myElement).findAssignedValue();
|
||||
if (assignedValue instanceof PyReferenceExpression) {
|
||||
final PsiElement resolved = resolveWithoutImplicits((PyReferenceExpression)assignedValue);
|
||||
final PsiElement resolved = resolve((PyReferenceExpression)assignedValue);
|
||||
if (resolved instanceof PyDocStringOwner) {
|
||||
String name = ((PyTargetExpression)myElement).getName();
|
||||
if (name != null) {
|
||||
@@ -581,7 +581,7 @@ public final class PyDocumentationBuilder {
|
||||
}
|
||||
// Reference expression can be passed as the target element in Python console
|
||||
if (myElement instanceof PyReferenceExpression) {
|
||||
final PsiElement resolved = resolveWithoutImplicits((PyReferenceExpression)myElement);
|
||||
final PsiElement resolved = resolve((PyReferenceExpression)myElement);
|
||||
if (resolved != null) {
|
||||
return resolved;
|
||||
}
|
||||
@@ -599,10 +599,10 @@ public final class PyDocumentationBuilder {
|
||||
return myElement;
|
||||
}
|
||||
|
||||
private @Nullable PsiElement resolveWithoutImplicits(@NotNull PyReferenceExpression element) {
|
||||
final PyResolveContext resolveContext = PyResolveContext.defaultContext(myContext);
|
||||
private @Nullable PsiElement resolve(@NotNull PyReferenceExpression element) {
|
||||
final PyResolveContext resolveContext = PyResolveContext.implicitContext(myContext);
|
||||
final QualifiedResolveResult resolveResult = element.followAssignmentsChain(resolveContext);
|
||||
return resolveResult.isImplicit() ? null : resolveResult.getElement();
|
||||
return resolveResult.getElement();
|
||||
}
|
||||
|
||||
private @Nullable PyStringLiteralExpression addFunctionInheritedDocString(@NotNull PyFunction pyFunction, @NotNull PyClass pyClass) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body><div class="bottom"><icon src="AllIcons.Nodes.Class"/> <code><a href="psi_element://#typename#ImplicitResolve.Proxy">ImplicitResolve.Proxy</a></code></div><div class="definition"><pre><span style="color:#000080;font-weight:bold;">def </span><span style="color:#000000;">documented_method</span><span style="">(</span><span style="color:#94558d;">self</span><span style="">)</span> -> <span style="color:#000000;"><span style="color:#000080;font-weight:bold;">None</span></span></pre></div><div class="content">method documentation</div></body></html>
|
||||
@@ -0,0 +1,15 @@
|
||||
from typing import Any
|
||||
|
||||
def my_func() -> Any:
|
||||
return object()
|
||||
|
||||
s = my_func()
|
||||
s.<the_ref>documented_method()
|
||||
|
||||
from openstack import proxy
|
||||
class Proxy(proxy.Proxy):
|
||||
def documented_method(self):
|
||||
"""
|
||||
method documentation
|
||||
"""
|
||||
return None
|
||||
@@ -860,6 +860,11 @@ public class Py3QuickDocTest extends LightMarkedTestCase {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
// PY-77171
|
||||
public void testImplicitResolve() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return super.getTestDataPath() + "/quickdoc/";
|
||||
|
||||
Reference in New Issue
Block a user