提交 5846123d 编写于 作者: E Evgeny Gerashchenko

Made "Remove Explicitly Specified Type" available on property type.

上级 d9fc85f6
......@@ -56,6 +56,10 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
JetTypeReference typeRefParent = PsiTreeUtil.getTopmostParentOfType(element, JetTypeReference.class);
if (typeRefParent != null) {
element = typeRefParent;
}
PsiElement parent = element.getParent();
JetType type = getTypeForDeclaration((JetNamedDeclaration) parent);
if (ErrorUtils.isErrorType(type)) {
......@@ -91,6 +95,10 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
JetTypeReference typeRefParent = PsiTreeUtil.getTopmostParentOfType(element, JetTypeReference.class);
if (typeRefParent != null) {
element = typeRefParent;
}
PsiElement parent = element.getParent();
if (!(parent instanceof JetNamedDeclaration)) {
return false;
......
// "Remove Explicitly Specified Type" "true"
import java.util.Map
val x = null
\ No newline at end of file
// "Remove Explicitly Specified Type" "true"
import java.util.Map
val x : Map.Entry<Stri<caret>ng, Int>? = null
\ No newline at end of file
......@@ -53,6 +53,10 @@ public class SpecifyTypeExplicitlyTest extends LightIntentionActionTestCase {
doTest();
}
public void testOnType() {
doTest();
}
@Override
protected String getTestDataPath() {
return PluginTestCaseBase.getTestDataPathBase() + "/intentions/";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册