mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
try whole statement preselection when incomplete
This commit is contained in:
+12
-6
@@ -134,12 +134,18 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
}
|
||||
else {
|
||||
int selection;
|
||||
PsiExpression expression = expressions.get(0);
|
||||
if (expression instanceof PsiReferenceExpression && ((PsiReferenceExpression)expression).resolve() instanceof PsiLocalVariable) {
|
||||
selection = 1;
|
||||
}
|
||||
else {
|
||||
selection = -1;
|
||||
if (statementsInRange.length == 1 &&
|
||||
statementsInRange[0] instanceof PsiExpressionStatement &&
|
||||
PsiUtilCore.hasErrorElementChild(statementsInRange[0])) {
|
||||
selection = expressions.indexOf(((PsiExpressionStatement)statementsInRange[0]).getExpression());
|
||||
} else {
|
||||
PsiExpression expression = expressions.get(0);
|
||||
if (expression instanceof PsiReferenceExpression && ((PsiReferenceExpression)expression).resolve() instanceof PsiLocalVariable) {
|
||||
selection = 1;
|
||||
}
|
||||
else {
|
||||
selection = -1;
|
||||
}
|
||||
}
|
||||
IntroduceTargetChooser.showChooser(editor, expressions,
|
||||
new Pass<PsiExpression>(){
|
||||
|
||||
Reference in New Issue
Block a user