mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-24258 check that parentheses belong to an argument list
This commit is contained in:
@@ -627,7 +627,8 @@ public class PythonDocumentationProvider extends AbstractDocumentationProvider i
|
||||
if (PythonDialectsTokenSetProvider.INSTANCE.getKeywordTokens().contains(elementType)) {
|
||||
return contextElement;
|
||||
}
|
||||
if (PyTokenTypes.LPAR == elementType || PyTokenTypes.RPAR == elementType) {
|
||||
final PsiElement parent = contextElement.getParent();
|
||||
if (parent instanceof PyArgumentList && (PyTokenTypes.LPAR == elementType || PyTokenTypes.RPAR == elementType)) {
|
||||
final PyCallExpression expression = PsiTreeUtil.getParentOfType(contextElement, PyCallExpression.class);
|
||||
if (expression != null) {
|
||||
final PyExpression callee = expression.getCallee();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# directly in function
|
||||
def foo():
|
||||
"<the_doc>Doc of foo."
|
||||
pass
|
||||
|
||||
def bar(param):
|
||||
pass
|
||||
|
||||
bar((1, foo<the_ref>))
|
||||
@@ -300,6 +300,14 @@ public class PyQuickDocTest extends LightMarkedTestCase {
|
||||
checkByHTML(myProvider.generateDoc(element, originalElement));
|
||||
}
|
||||
|
||||
public void testNotArgumentList() {
|
||||
Map<String, PsiElement> marks = loadTest();
|
||||
final PsiElement originalElement = marks.get("<the_ref>");
|
||||
|
||||
final PsiElement element = myProvider.getCustomDocumentationElement(myFixture.getEditor(), myFile, originalElement);
|
||||
assertNull(element);
|
||||
}
|
||||
|
||||
public void testDocstring() {
|
||||
Map<String, PsiElement> marks = loadTest();
|
||||
final PsiElement originalElement = marks.get("<the_ref>");
|
||||
|
||||
Reference in New Issue
Block a user