diff --git a/idea/resources/META-INF/plugin-common.xml b/idea/resources/META-INF/plugin-common.xml
index f47d8737596..1f00996d0f1 100644
--- a/idea/resources/META-INF/plugin-common.xml
+++ b/idea/resources/META-INF/plugin-common.xml
@@ -593,6 +593,7 @@
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/editor/wordSelection/KotlinClassMemberSelectioner.kt b/idea/src/org/jetbrains/kotlin/idea/editor/wordSelection/KotlinClassMemberSelectioner.kt
new file mode 100644
index 00000000000..32feac4b452
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/editor/wordSelection/KotlinClassMemberSelectioner.kt
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
+ * that can be found in the license/LICENSE.txt file.
+ */
+
+package org.jetbrains.kotlin.idea.editor.wordSelection
+
+import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.util.TextRange
+import com.intellij.psi.PsiElement
+import org.jetbrains.kotlin.psi.KtClassBody
+import org.jetbrains.kotlin.psi.psiUtil.getNextSiblingIgnoringWhitespace
+import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespace
+
+class KotlinClassMemberSelectioner : ExtendWordSelectionHandlerBase() {
+ override fun canSelect(e: PsiElement): Boolean {
+ return e.parent is KtClassBody
+ }
+
+ override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List? {
+ val parent = e.parent
+ val firstChild = parent.firstChild ?: return null
+ val lastChild = parent.lastChild ?: return null
+ val startElement = firstChild.getNextSiblingIgnoringWhitespace() ?: firstChild
+ val endElement = lastChild.getPrevSiblingIgnoringWhitespace() ?: lastChild
+ val textRange = TextRange(startElement.textRange.startOffset, endElement.textRange.endOffset)
+ return expandToWholeLinesWithBlanks(editorText, textRange)
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember1/0.kt b/idea/testData/wordSelection/ClassMember1/0.kt
new file mode 100644
index 00000000000..f473c46a8e7
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember1/0.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember1/1.kt b/idea/testData/wordSelection/ClassMember1/1.kt
new file mode 100644
index 00000000000..0bc3a433683
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember1/1.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember1/2.kt b/idea/testData/wordSelection/ClassMember1/2.kt
new file mode 100644
index 00000000000..254010148e5
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember1/2.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember1/3.kt b/idea/testData/wordSelection/ClassMember1/3.kt
new file mode 100644
index 00000000000..068a11d13f6
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember1/3.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember1/4.kt b/idea/testData/wordSelection/ClassMember1/4.kt
new file mode 100644
index 00000000000..01768dddf38
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember1/4.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember1/5.kt b/idea/testData/wordSelection/ClassMember1/5.kt
new file mode 100644
index 00000000000..e8b5370e5f4
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember1/5.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember2/0.kt b/idea/testData/wordSelection/ClassMember2/0.kt
new file mode 100644
index 00000000000..9b349fa0ac1
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember2/0.kt
@@ -0,0 +1,13 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember2/1.kt b/idea/testData/wordSelection/ClassMember2/1.kt
new file mode 100644
index 00000000000..59776f92832
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember2/1.kt
@@ -0,0 +1,13 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember2/2.kt b/idea/testData/wordSelection/ClassMember2/2.kt
new file mode 100644
index 00000000000..90e6a376ab4
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember2/2.kt
@@ -0,0 +1,13 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember2/3.kt b/idea/testData/wordSelection/ClassMember2/3.kt
new file mode 100644
index 00000000000..6665f62e821
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember2/3.kt
@@ -0,0 +1,13 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember2/4.kt b/idea/testData/wordSelection/ClassMember2/4.kt
new file mode 100644
index 00000000000..f2cbfc32aff
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember2/4.kt
@@ -0,0 +1,13 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember2/5.kt b/idea/testData/wordSelection/ClassMember2/5.kt
new file mode 100644
index 00000000000..3b1b60ebe84
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember2/5.kt
@@ -0,0 +1,13 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember3/0.kt b/idea/testData/wordSelection/ClassMember3/0.kt
new file mode 100644
index 00000000000..35b2260e26b
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember3/0.kt
@@ -0,0 +1,13 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember3/1.kt b/idea/testData/wordSelection/ClassMember3/1.kt
new file mode 100644
index 00000000000..6ad8a0140d1
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember3/1.kt
@@ -0,0 +1,13 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember3/2.kt b/idea/testData/wordSelection/ClassMember3/2.kt
new file mode 100644
index 00000000000..56fcd301f45
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember3/2.kt
@@ -0,0 +1,13 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember3/3.kt b/idea/testData/wordSelection/ClassMember3/3.kt
new file mode 100644
index 00000000000..932131af573
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember3/3.kt
@@ -0,0 +1,13 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember3/4.kt b/idea/testData/wordSelection/ClassMember3/4.kt
new file mode 100644
index 00000000000..dafbc14b2c1
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember3/4.kt
@@ -0,0 +1,13 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember3/5.kt b/idea/testData/wordSelection/ClassMember3/5.kt
new file mode 100644
index 00000000000..4065963b63b
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember3/5.kt
@@ -0,0 +1,13 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/0.kt b/idea/testData/wordSelection/ClassMember4/0.kt
new file mode 100644
index 00000000000..d78476ffc57
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/0.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/1.kt b/idea/testData/wordSelection/ClassMember4/1.kt
new file mode 100644
index 00000000000..37c41f6b8bc
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/1.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/2.kt b/idea/testData/wordSelection/ClassMember4/2.kt
new file mode 100644
index 00000000000..e3b62440813
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/2.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/3.kt b/idea/testData/wordSelection/ClassMember4/3.kt
new file mode 100644
index 00000000000..1217964a91e
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/3.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/4.kt b/idea/testData/wordSelection/ClassMember4/4.kt
new file mode 100644
index 00000000000..2b30a73f2c7
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/4.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/5.kt b/idea/testData/wordSelection/ClassMember4/5.kt
new file mode 100644
index 00000000000..d098bd2ef3f
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/5.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/6.kt b/idea/testData/wordSelection/ClassMember4/6.kt
new file mode 100644
index 00000000000..f7fea252f46
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/6.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember4/7.kt b/idea/testData/wordSelection/ClassMember4/7.kt
new file mode 100644
index 00000000000..97f7161d4af
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember4/7.kt
@@ -0,0 +1,14 @@
+class C {
+
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember5/0.kt b/idea/testData/wordSelection/ClassMember5/0.kt
new file mode 100644
index 00000000000..56c5b01f9ca
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember5/0.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember5/1.kt b/idea/testData/wordSelection/ClassMember5/1.kt
new file mode 100644
index 00000000000..bfd4484ae1b
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember5/1.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember5/2.kt b/idea/testData/wordSelection/ClassMember5/2.kt
new file mode 100644
index 00000000000..1db49415dec
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember5/2.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember5/3.kt b/idea/testData/wordSelection/ClassMember5/3.kt
new file mode 100644
index 00000000000..8d14fb072e2
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember5/3.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember5/4.kt b/idea/testData/wordSelection/ClassMember5/4.kt
new file mode 100644
index 00000000000..643585257a9
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember5/4.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/testData/wordSelection/ClassMember5/5.kt b/idea/testData/wordSelection/ClassMember5/5.kt
new file mode 100644
index 00000000000..5153b805aae
--- /dev/null
+++ b/idea/testData/wordSelection/ClassMember5/5.kt
@@ -0,0 +1,12 @@
+class C {
+ constructor()
+
+ init {
+ }
+
+ fun foo() {
+ }
+
+ // comment
+ val bar = 1
+}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/WordSelectionTest.java b/idea/tests/org/jetbrains/kotlin/idea/WordSelectionTest.java
index 6acecacd8b8..175083c88e3 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/WordSelectionTest.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/WordSelectionTest.java
@@ -135,6 +135,12 @@ public class WordSelectionTest extends KotlinLightCodeInsightFixtureTestCase {
public void testLabeledReturn() { doTest(); }
+ public void testClassMember1() { doTest(); }
+ public void testClassMember2() { doTest(); }
+ public void testClassMember3() { doTest(); }
+ public void testClassMember4() { doTest(); }
+ public void testClassMember5() { doTest(); }
+
private void doTest() {
String dirName = getTestName(false);