- KT-1147 Can't see local variable in completion
- Disable class level keywords from method parameters list - Reorganize completion tests to separate methods
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.jetbrains.jet.lang.descriptors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.util.QualifiedNamesUtil;
|
||||
|
||||
/**
|
||||
* @author Nikolay Krasko
|
||||
@@ -28,7 +29,7 @@ public final class DescriptorsUtils {
|
||||
public static String getFQName(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
if (functionDescriptor.getContainingDeclaration() instanceof NamespaceDescriptor) {
|
||||
final String namespaceFQN = getFQName((NamespaceDescriptor) functionDescriptor.getContainingDeclaration());
|
||||
return !namespaceFQN.isEmpty() ? namespaceFQN + "." + functionDescriptor.getName() : functionDescriptor.getName();
|
||||
return QualifiedNamesUtil.combine(namespaceFQN, functionDescriptor.getName());
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Currently supported only for top level functions");
|
||||
|
||||
@@ -32,7 +32,9 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
PsiElement parent = getParent();
|
||||
if (parent instanceof JetQualifiedExpression && !isImportDirectiveExpression()) {
|
||||
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) parent;
|
||||
return qualifiedExpression.getReceiverExpression();
|
||||
if (!isFirstPartInQualifiedExpression(qualifiedExpression)) {
|
||||
return qualifiedExpression.getReceiverExpression();
|
||||
}
|
||||
} else if (parent instanceof JetCallExpression) {
|
||||
//This is in case `a().b()`
|
||||
JetCallExpression callExpression = (JetCallExpression) parent;
|
||||
@@ -45,6 +47,15 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check that this is simple name expression is first part in full qualified name: firstPart.otherPart.otherPart.call()
|
||||
private boolean isFirstPartInQualifiedExpression(JetQualifiedExpression qualifiedExpression) {
|
||||
if (qualifiedExpression.getParent() instanceof JetQualifiedExpression) {
|
||||
return isFirstPartInQualifiedExpression((JetQualifiedExpression) qualifiedExpression.getParent());
|
||||
}
|
||||
|
||||
return qualifiedExpression.getFirstChild() == this;
|
||||
}
|
||||
|
||||
public boolean isImportDirectiveExpression() {
|
||||
PsiElement parent = getParent();
|
||||
if (parent == null) return false;
|
||||
|
||||
Reference in New Issue
Block a user