mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-149428 Suggested variable name on a chain of lambdas has a different name to the original
This commit is contained in:
+1
-1
@@ -259,6 +259,6 @@ public class FunctionalExpressionCompletionProvider extends CompletionProvider<C
|
||||
}
|
||||
|
||||
private static String getParamName(PsiParameter param, JavaCodeStyleManager javaCodeStyleManager, PsiElement originalPosition) {
|
||||
return javaCodeStyleManager.suggestUniqueVariableName(param.getName(), originalPosition, true);
|
||||
return javaCodeStyleManager.suggestUniqueVariableName(param.getName(), originalPosition, false);
|
||||
}
|
||||
}
|
||||
|
||||
+28
-2
@@ -66,12 +66,38 @@ interface I {
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
public static void main(int x) {
|
||||
I i = <caret>
|
||||
}
|
||||
}"""
|
||||
def items = myFixture.completeBasic()
|
||||
assert LookupElementPresentation.renderElement(items[0]).itemText == 'x -> {}'
|
||||
assert LookupElementPresentation.renderElement(items[0]).itemText == 'x1 -> {}'
|
||||
}
|
||||
|
||||
public void "test lambda signature duplicate parameter name"() {
|
||||
myFixture.configureByText "a.java", """
|
||||
import java.util.function.Function;
|
||||
|
||||
public class E {
|
||||
public static void main(String[] args) {
|
||||
Observable.just(new InterestingClass())
|
||||
.doOnNext(interestingClass -> doSomething())
|
||||
.doOnNext(inter<caret>)
|
||||
}
|
||||
}
|
||||
|
||||
class Observable {
|
||||
static <T> Smth<T> just(T t) { }
|
||||
}
|
||||
|
||||
class Smth<T> {
|
||||
Smth<T> doOnNext(Function<T, Void> fun) { }
|
||||
}
|
||||
|
||||
class InterestingClass {}
|
||||
"""
|
||||
def items = myFixture.completeBasic()
|
||||
assert LookupElementPresentation.renderElement(items[0]).itemText == 'interestingClass -> {}'
|
||||
}
|
||||
|
||||
public void "test suggest this method references"() {
|
||||
|
||||
Reference in New Issue
Block a user