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).
This commit is contained in:
Mikhail Golubev
2016-12-30 15:21:54 +03:00
parent 2383379c31
commit 87154f1b52
3 changed files with 3 additions and 3 deletions
@@ -137,7 +137,7 @@ public class ImportCandidateHolder implements Comparable<ImportCandidateHolder>
parent = myImportElement.getParent();
}
if (myImportable instanceof PyFunction) {
sb.append(((PyFunction)myImportable).getParameterList().getPresentableText(false));
sb.append("()");
}
else if (myImportable instanceof PyClass) {
final List<String> supers = ContainerUtil.mapNotNull(((PyClass)myImportable).getSuperClasses(null),
@@ -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;
@@ -42,7 +42,7 @@ public class AddImportQuickFixTest extends PyQuickFixTestCase {
doMultiFileAutoImportTest("Import", fix -> {
final List<ImportCandidateHolder> candidates = fix.getCandidates();
final List<String> names = ContainerUtil.map(candidates, c -> c.getPresentableText("join"));
assertSameElements(names, "os.path.join(path, *paths)");
assertSameElements(names, "os.path.join()");
return true;
});
}