mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-121756 Don't provide postfix completion options in java string literals
This commit is contained in:
+23
-2
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import com.intellij.codeInsight.template.postfix.util.PostfixTemplatesUtils;
|
||||
@@ -65,8 +80,14 @@ public abstract class ExpressionPostfixTemplateWithChooser extends PostfixTempla
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected List<PsiExpression> getExpressions(@NotNull PsiElement context, @NotNull Document document, int offset) {
|
||||
List<PsiExpression> expressions = IntroduceVariableBase.collectExpressions(context.getContainingFile(), document, offset, false);
|
||||
protected List<PsiExpression> getExpressions(@NotNull PsiElement context, @NotNull Document document, final int offset) {
|
||||
List<PsiExpression> expressions = ContainerUtil.filter(IntroduceVariableBase.collectExpressions(context.getContainingFile(), document, offset - 1, false),
|
||||
new Condition<PsiExpression>() {
|
||||
@Override
|
||||
public boolean value(PsiExpression expression) {
|
||||
return expression.getTextRange().getEndOffset() == offset;
|
||||
}
|
||||
});
|
||||
return ContainerUtil.filter(expressions.isEmpty() ? maybeTopmostExpression(context) : expressions, getTypeCondition());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m(Object o) {
|
||||
Integer string = (Integer.parseInt("test.test.cast<caret>"));
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m(Object o) {
|
||||
Integer string = (Integer.parseInt("test.test.cast <caret>"));
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m(Object o) {
|
||||
Integer string = (Integer.parseInt("test.test".cast<caret>));
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m(Object o) {
|
||||
Integer string = (Integer.parseInt((() "test.test")<caret>));
|
||||
}
|
||||
}
|
||||
+17
-3
@@ -1,10 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author ignatov
|
||||
*/
|
||||
public class CastPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -12,4 +24,6 @@ public class CastPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
|
||||
public void testSingleExpression() { doTest(); } // jdk mock needed
|
||||
public void testVoidExpression() { doTest(); }
|
||||
public void testSingleArgument() { doTest(); }
|
||||
public void testInsideString() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user