mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed completion of PyCustomMembers whose names don't match the names of resolved references (PY-14519)
This commit is contained in:
@@ -305,11 +305,16 @@ public class PyModuleType implements PyType { // Modules don't descend from obje
|
||||
final PsiElement resolved = member.resolve(location);
|
||||
if (resolved != null) {
|
||||
processor.execute(resolved, ResolveState.initial());
|
||||
result.addAll(processor.getResultList());
|
||||
}
|
||||
else {
|
||||
result.add(LookupElementBuilder.create(name).withIcon(member.getIcon()).withTypeText(member.getShortType()));
|
||||
final List<LookupElement> lookupList = processor.getResultList();
|
||||
if (!lookupList.isEmpty()) {
|
||||
final LookupElement element = lookupList.get(0);
|
||||
if (name.equals(element.getLookupString())) {
|
||||
result.add(element);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
result.add(LookupElementBuilder.create(name).withIcon(member.getIcon()).withTypeText(member.getShortType()));
|
||||
}
|
||||
}
|
||||
if (point == PointInImport.NONE || point == PointInImport.AS_NAME) { // when not imported from, add regular attributes
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import os
|
||||
|
||||
os.path
|
||||
@@ -0,0 +1,3 @@
|
||||
import os
|
||||
|
||||
os.pat<caret>
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -722,4 +722,14 @@ public class PythonCompletionTest extends PyTestCase {
|
||||
assertNotNull(suggested);
|
||||
assertSameElements(suggested, "VAR", "subpkg1");
|
||||
}
|
||||
|
||||
// PY-14519
|
||||
public void testOsPath() {
|
||||
myFixture.copyDirectoryToProject("completion/" + getTestName(true), "");
|
||||
myFixture.configureByFile("a.py");
|
||||
myFixture.completeBasic();
|
||||
final List<String> suggested = myFixture.getLookupElementStrings();
|
||||
assertNotNull(suggested);
|
||||
assertContainsElements(suggested, "path");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user