diff --git a/python/psi-api/src/com/jetbrains/python/psi/Callable.java b/python/psi-api/src/com/jetbrains/python/psi/Callable.java
index 51267edd7619..40505a9e1c04 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/Callable.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/Callable.java
@@ -7,9 +7,8 @@ import org.jetbrains.annotations.Nullable;
/**
* Something that can be called, passed parameters to, and return something back.
- *
- * User: dcheryasov
- * Date: May 15, 2010 3:22:30 PM
+
+ * @author dcheryasov
*/
public interface Callable extends PyElement {
@@ -31,4 +30,11 @@ public interface Callable extends PyElement {
@Nullable
PyFunction asMethod();
+ /**
+ * Returns the qualified name of the function.
+ *
+ * @return the qualified name of the function, or null for a lambda expression.
+ */
+ @Nullable
+ String getQualifiedName();
}
diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyClass.java b/python/psi-api/src/com/jetbrains/python/psi/PyClass.java
index a6f74c55a253..b70a4604d3f8 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/PyClass.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/PyClass.java
@@ -69,6 +69,8 @@ public interface PyClass extends PsiNameIdentifierOwner, PyStatement, NameDefine
PyFunction findInitOrNew(boolean inherited);
/**
+ * Finds a property with the specified name in the class or one of its ancestors.
+ *
* @param name of the property
* @return descriptor of property accessors, or null if such property does not exist.
*/
diff --git a/python/src/META-INF/python-plugin-common.xml b/python/src/META-INF/python-plugin-common.xml
index 5f8b2610115f..dd00b4ba8f7c 100644
--- a/python/src/META-INF/python-plugin-common.xml
+++ b/python/src/META-INF/python-plugin-common.xml
@@ -419,6 +419,8 @@
+
+
@@ -603,6 +605,9 @@
+
+
+
@@ -638,9 +643,6 @@
-
-
-
@@ -660,8 +662,6 @@
-
-
@@ -822,6 +822,9 @@
+
+
+
diff --git a/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java
index 69e36e05e9c0..df7e136264a1 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java
@@ -24,6 +24,7 @@ import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.documentation.StructuredDocString;
import com.jetbrains.python.psi.*;
+import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
import com.jetbrains.python.psi.stubs.PyClassStub;
import com.jetbrains.python.psi.stubs.PyFunctionStub;
import com.jetbrains.python.psi.stubs.PyTargetExpressionStub;
@@ -625,4 +626,25 @@ public class PyFunctionImpl extends PyPresentableElementImpl imp
}
return null;
}
+
+ @Nullable
+ @Override
+ public String getQualifiedName() {
+ String name = getName();
+ if (name == null) {
+ return null;
+ }
+ PyClass containingClass = getContainingClass();
+ if (containingClass != null) {
+ return containingClass.getQualifiedName() + "." + name;
+ }
+ if (PsiTreeUtil.getStubOrPsiParent(this) instanceof PyFile) {
+ VirtualFile virtualFile = getContainingFile().getVirtualFile();
+ if (virtualFile != null) {
+ final String packageName = QualifiedNameFinder.findShortestImportableName(this, virtualFile);
+ return packageName + "." + name;
+ }
+ }
+ return null;
+ }
}
diff --git a/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java
index b8aaf4536dae..ee02c122cd01 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java
@@ -58,4 +58,10 @@ public class PyLambdaExpressionImpl extends PyElementImpl implements PyLambdaExp
super.subtreeChanged();
ControlFlowCache.clear(this);
}
+
+ @Nullable
+ @Override
+ public String getQualifiedName() {
+ return null;
+ }
}