couple of fixes needed to have rename work
This commit is contained in:
@@ -31,4 +31,10 @@ public abstract class JetNamedDeclaration extends JetDeclaration implements PsiN
|
||||
public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
|
||||
return getNameIdentifier().replace(JetChangeUtil.createNameIdentifier(getProject(), name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextOffset() {
|
||||
PsiElement identifier = getNameIdentifier();
|
||||
return identifier != null ? identifier.getTextRange().getStartOffset() : getTextRange().getStartOffset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
@@ -106,6 +107,12 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
|
||||
PsiElement element = JetChangeUtil.createNameIdentifier(getProject(), newElementName);
|
||||
return getReferencedNameElement().replace(element);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user