IDEA-149712 Change widen-selection (ctrl-w) behaviour for a class or method with a comment

This commit is contained in:
Dmitry Batrak
2015-12-25 19:10:58 +03:00
parent 86b2b222ba
commit 1480d3bda7
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -40,8 +40,7 @@ public class MethodOrClassSelectioner extends BasicSelectioner {
@Override
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
List<TextRange> result = ContainerUtil.newArrayList(e.getTextRange());
result.addAll(expandToWholeLinesWithBlanks(editorText, e.getTextRange()));
List<TextRange> result = ContainerUtil.newArrayList();
PsiElement firstChild = e.getFirstChild();
PsiElement[] children = e.getChildren();
@@ -77,6 +76,9 @@ public class MethodOrClassSelectioner extends BasicSelectioner {
result.addAll(expandToWholeLinesWithBlanks(editorText, range));
}
result.add(e.getTextRange());
result.addAll(expandToWholeLinesWithBlanks(editorText, e.getTextRange()));
if (e instanceof PsiClass) {
result.addAll(selectWithTypeParameters((PsiClass)e));
result.addAll(selectBetweenBracesLines(children, editorText));