mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-17 16:19:58 +07:00
select whole line when caret is out of statement
This commit is contained in:
+5
-1
@@ -90,7 +90,11 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
final PsiElement[] statementsInRange = findStatementsAtOffset(editor, file, offset);
|
||||
|
||||
//try line selection
|
||||
if (statementsInRange.length == 1 && (PsiUtil.hasErrorElementChild(statementsInRange[0]) || !PsiUtil.isStatement(statementsInRange[0]) || isPreferStatements())) {
|
||||
if (statementsInRange.length == 1 && (PsiUtil.hasErrorElementChild(statementsInRange[0]) ||
|
||||
!PsiUtil.isStatement(statementsInRange[0]) ||
|
||||
statementsInRange[0].getTextRange().getStartOffset() >= offset ||
|
||||
statementsInRange[0].getTextRange().getEndOffset() <= offset ||
|
||||
isPreferStatements())) {
|
||||
selectionModel.selectLineAtCaret();
|
||||
if (findExpressionInRange(project, file, selectionModel.getSelectionStart(), selectionModel.getSelectionEnd()) == null) {
|
||||
selectionModel.removeSelection();
|
||||
|
||||
Reference in New Issue
Block a user