mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-24854 Allow Quick Documentation invocation when caret is placed inside docstring
This commit is contained in:
@@ -566,6 +566,10 @@ public class PythonDocumentationProvider extends AbstractDocumentationProvider i
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PyTokenTypes.DOCSTRING == elementType) {
|
||||
final PyDocStringOwner docstringOwner = PsiTreeUtil.getParentOfType(contextElement, PyDocStringOwner.class);
|
||||
if (docstringOwner != null) return docstringOwner;
|
||||
}
|
||||
}
|
||||
return super.getCustomDocumentationElement(editor, file, contextElement);
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body><code>def <b>foo</b>()<br>Inferred type: () -> None<br><br>Doc of foo.</code></body></html>
|
||||
@@ -0,0 +1,6 @@
|
||||
# directly in function
|
||||
def foo():
|
||||
"<the_doc>Doc of <the_ref>foo."
|
||||
pass
|
||||
|
||||
foo()
|
||||
@@ -300,6 +300,14 @@ public class PyQuickDocTest extends LightMarkedTestCase {
|
||||
checkByHTML(myProvider.generateDoc(element, originalElement));
|
||||
}
|
||||
|
||||
public void testDocstring() {
|
||||
Map<String, PsiElement> marks = loadTest();
|
||||
final PsiElement originalElement = marks.get("<the_ref>");
|
||||
|
||||
final PsiElement element = myProvider.getCustomDocumentationElement(myFixture.getEditor(), myFile, originalElement);
|
||||
checkByHTML(myProvider.generateDoc(element, originalElement));
|
||||
}
|
||||
|
||||
public void testReferenceToMethodQualifiedWithInstance() {
|
||||
checkHTMLOnly();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user