mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user