Allow to select single word on double click in one line doc comment (KT-14327)
(cherry picked from commit 184d39a) #KT-14327 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
ba0e36cdb1
commit
e41cddd870
@@ -34,7 +34,6 @@ class KotlinWordSelectionFilter : Condition<PsiElement>{
|
|||||||
if (elementType == KtTokens.REGULAR_STRING_PART || elementType == KtTokens.ESCAPE_SEQUENCE) return true
|
if (elementType == KtTokens.REGULAR_STRING_PART || elementType == KtTokens.ESCAPE_SEQUENCE) return true
|
||||||
|
|
||||||
if (e is KtContainerNode) return false
|
if (e is KtContainerNode) return false
|
||||||
if (e.parent.firstChild.nextSibling == null && e.parent !is KtContainerNode) return false // skip nodes with the same range as their parent
|
|
||||||
|
|
||||||
return when (e.node.elementType) {
|
return when (e.node.elementType) {
|
||||||
BLOCK, KDocElementTypes.KDOC_SECTION -> false
|
BLOCK, KDocElementTypes.KDOC_SECTION -> false
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/** Doc comment <caret>here */
|
||||||
|
fun foo() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/** Doc comment <selection><caret>here</selection> */
|
||||||
|
fun foo() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/**<selection> Doc comment <caret>here </selection>*/
|
||||||
|
fun foo() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* @param <caret>a The description of a.
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* @param <selection><caret>a</selection> The description of a.
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* <selection>@param <caret>a The description of a.</selection>
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* @pa<caret>ram a The description of a.
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* @<selection>pa<caret>ram</selection> a The description of a.
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* <selection>@pa<caret>ram</selection> a The description of a.
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* <selection>@pa<caret>ram a The description of a.</selection>
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* @param a The descr<caret>iption of a.
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* @param a The <selection>descr<caret>iption</selection> of a.
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* @param a <selection>The descr<caret>iption of a.</selection>
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Doc comment
|
||||||
|
* <selection>@param a The descr<caret>iption of a.</selection>
|
||||||
|
*/
|
||||||
|
fun foo(a: Int) {
|
||||||
|
}
|
||||||
@@ -51,6 +51,14 @@ public class WordSelectionTest extends KotlinLightCodeInsightFixtureTestCase {
|
|||||||
|
|
||||||
public void testDocComment() { doTest(); }
|
public void testDocComment() { doTest(); }
|
||||||
|
|
||||||
|
public void testDocCommentOneLine() { doTest(); }
|
||||||
|
|
||||||
|
public void testDocCommentTagName() { doTest(); }
|
||||||
|
|
||||||
|
public void testDocCommentTagText() { doTest(); }
|
||||||
|
|
||||||
|
public void testDocCommentTagLink() { doTest(); }
|
||||||
|
|
||||||
public void testFunctionWithLineCommentBefore() { doTest(); }
|
public void testFunctionWithLineCommentBefore() { doTest(); }
|
||||||
|
|
||||||
public void testFunctionWithLineCommentAfter() { doTest(); }
|
public void testFunctionWithLineCommentAfter() { doTest(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user