From 87154f1b52ed0ef5eb80536c676b19ce4e3203e1 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Thu, 29 Dec 2016 15:03:00 +0300 Subject: [PATCH] Don't show function parameters in the list of suggestions for import Otherwise it becomes difficult to determine the right signature to display since there might be several overloads of the same function in .pyi files. Overall, if there were several definitions of the same function, for example, in the actual module and in the .pyi file/user skeletons, it wasn't clear which signature would be displayed because it depended on the order in which functions were returned from the index in PythonImportUtils.addSymbolImportCandidates() (it was discovered thanks to a blinking test on TC). --- .../python/codeInsight/imports/ImportCandidateHolder.java | 2 +- python/testSrc/com/jetbrains/python/PyQuickFixTest.java | 2 +- .../com/jetbrains/python/quickFixes/AddImportQuickFixTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/src/com/jetbrains/python/codeInsight/imports/ImportCandidateHolder.java b/python/src/com/jetbrains/python/codeInsight/imports/ImportCandidateHolder.java index c97941077f4f..a767bba92e3b 100644 --- a/python/src/com/jetbrains/python/codeInsight/imports/ImportCandidateHolder.java +++ b/python/src/com/jetbrains/python/codeInsight/imports/ImportCandidateHolder.java @@ -137,7 +137,7 @@ public class ImportCandidateHolder implements Comparable parent = myImportElement.getParent(); } if (myImportable instanceof PyFunction) { - sb.append(((PyFunction)myImportable).getParameterList().getPresentableText(false)); + sb.append("()"); } else if (myImportable instanceof PyClass) { final List supers = ContainerUtil.mapNotNull(((PyClass)myImportable).getSuperClasses(null), diff --git a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java index cab016a488e6..fa181eb9d4eb 100644 --- a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java +++ b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java @@ -113,7 +113,7 @@ public class PyQuickFixTest extends PyTestCase { settings.HIGHLIGHT_UNUSED_IMPORTS = false; try { doInspectionTest(new String[]{"AddToImportFromList.py", "AddToImportFromFoo.py"}, PyUnresolvedReferencesInspection.class, - "Import 'foo(a) from AddToImportFromFoo'", true, true); + "Import 'foo() from AddToImportFromFoo'", true, true); } finally { settings.HIGHLIGHT_UNUSED_IMPORTS = oldHighlightUnused; diff --git a/python/testSrc/com/jetbrains/python/quickFixes/AddImportQuickFixTest.java b/python/testSrc/com/jetbrains/python/quickFixes/AddImportQuickFixTest.java index dc806a15d3ce..bc213b0a6594 100644 --- a/python/testSrc/com/jetbrains/python/quickFixes/AddImportQuickFixTest.java +++ b/python/testSrc/com/jetbrains/python/quickFixes/AddImportQuickFixTest.java @@ -42,7 +42,7 @@ public class AddImportQuickFixTest extends PyQuickFixTestCase { doMultiFileAutoImportTest("Import", fix -> { final List candidates = fix.getCandidates(); final List names = ContainerUtil.map(candidates, c -> c.getPresentableText("join")); - assertSameElements(names, "os.path.join(path, *paths)"); + assertSameElements(names, "os.path.join()"); return true; }); }