mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use correct name when completing imported module (PY-1955); add icon
This commit is contained in:
@@ -104,12 +104,12 @@ public class VariantsProcessor implements PsiScopeProcessor {
|
||||
if (element instanceof PyImportElement) {
|
||||
PyReferenceExpression ref = ((PyImportElement)element).getImportReference();
|
||||
if (ref != null) {
|
||||
final String name = ref.getName();
|
||||
if (nameIsAcceptable(name)) {
|
||||
String name = ref.getName();
|
||||
if (name != null && nameIsAcceptable(name)) {
|
||||
PsiElement resolved = ref.getReference().resolve();
|
||||
if (resolved instanceof PsiNamedElement) {
|
||||
handled_as_imported = true;
|
||||
myVariants.put(name, setupItem(LookupElementBuilder.create((PsiNamedElement)resolved)));
|
||||
myVariants.put(name, setupItem(LookupElementBuilder.create(resolved, name).setIcon(resolved.getIcon(0))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from root import nested_mod
|
||||
|
||||
n = nested_mod
|
||||
@@ -0,0 +1,3 @@
|
||||
from root import nested_mod
|
||||
|
||||
n = nested_m<caret>
|
||||
@@ -213,4 +213,12 @@ public class PythonCompletionTest extends PyLightFixtureTestCase {
|
||||
myFixture.completeBasic();
|
||||
myFixture.checkResultByFile("completion/importItself.after.py");
|
||||
}
|
||||
|
||||
public void testImportedFile() { // PY-1955
|
||||
final String dirname = "completion/";
|
||||
myFixture.copyDirectoryToProject(dirname + "root", dirname + "root");
|
||||
myFixture.configureByFile(dirname + "importedFile.py");
|
||||
myFixture.completeBasic();
|
||||
myFixture.checkResultByFile(dirname + "importedFile.after.py");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user