mark last parenthesis instead of value argument list

This commit is contained in:
Svetlana Isakova
2012-10-16 18:24:06 +04:00
parent 0d4d576fed
commit e7cbff14ef
9 changed files with 40 additions and 16 deletions
@@ -352,7 +352,7 @@ public interface Errors {
AmbiguousDescriptorDiagnosticFactory OVERLOAD_RESOLUTION_AMBIGUITY = new AmbiguousDescriptorDiagnosticFactory();
AmbiguousDescriptorDiagnosticFactory NONE_APPLICABLE = new AmbiguousDescriptorDiagnosticFactory();
DiagnosticFactory1<PsiElement, ValueParameterDescriptor> NO_VALUE_FOR_PARAMETER = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<JetElement, ValueParameterDescriptor> NO_VALUE_FOR_PARAMETER = DiagnosticFactory1.create(ERROR, VALUE_ARGUMENTS);
DiagnosticFactory1<JetReferenceExpression, JetType> MISSING_RECEIVER = DiagnosticFactory1.create(ERROR);
SimpleDiagnosticFactory<JetReferenceExpression> NO_RECEIVER_ADMITTED = SimpleDiagnosticFactory.create(ERROR);
@@ -322,4 +322,19 @@ public class PositioningStrategies {
return super.mark(element);
}
};
public static PositioningStrategy<JetElement> VALUE_ARGUMENTS = new PositioningStrategy<JetElement>() {
@NotNull
@Override
public List<TextRange> mark(@NotNull JetElement element) {
if (element instanceof JetValueArgumentList) {
PsiElement rightParenthesis = ((JetValueArgumentList) element).getRightParenthesis();
if (rightParenthesis != null) {
return markElement(rightParenthesis);
}
}
return super.mark(element);
}
};
}
@@ -17,8 +17,11 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lexer.JetTokens;
import java.util.List;
@@ -43,4 +46,10 @@ public class JetValueArgumentList extends JetElementImpl {
public List<JetValueArgument> getArguments() {
return findChildrenByType(JetNodeTypes.VALUE_ARGUMENT);
}
@Nullable
public PsiElement getRightParenthesis() {
return findChildByType(JetTokens.RPAR);
}
}
@@ -133,7 +133,7 @@ public class ResolutionTask<D extends CallableDescriptor, F extends D> extends R
@Override
public void noValueForParameter(@NotNull BindingTrace trace, @NotNull ValueParameterDescriptor valueParameter) {
PsiElement reportOn;
JetElement reportOn;
JetValueArgumentList valueArgumentList = call.getValueArgumentList();
if (valueArgumentList != null) {
reportOn = valueArgumentList;