From 1480d3bda7b138a0d2daf85613654297748ff9e9 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Fri, 25 Dec 2015 19:10:15 +0300 Subject: [PATCH] IDEA-149712 Change widen-selection (ctrl-w) behaviour for a class or method with a comment --- .../wordSelection/MethodOrClassSelectioner.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java index c6526f63695c..59ee5a35a2bf 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java @@ -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 select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { - List result = ContainerUtil.newArrayList(e.getTextRange()); - result.addAll(expandToWholeLinesWithBlanks(editorText, e.getTextRange())); + List 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));