Corrected annotations: ExtendWordSelectionHandler CAN return null
This commit is contained in:
@@ -173,10 +173,9 @@
|
||||
</item>
|
||||
<item
|
||||
name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandler java.util.List<com.intellij.openapi.util.TextRange> select(com.intellij.psi.PsiElement, java.lang.CharSequence, int, com.intellij.openapi.editor.Editor)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
<annotation name='kotlin.jvm.KotlinSignature'>
|
||||
<val name="value"
|
||||
val=""fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>""/>
|
||||
val=""fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>?""/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item
|
||||
@@ -213,10 +212,9 @@
|
||||
</item>
|
||||
<item
|
||||
name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase java.util.List<com.intellij.openapi.util.TextRange> select(com.intellij.psi.PsiElement, java.lang.CharSequence, int, com.intellij.openapi.editor.Editor)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
<annotation name='kotlin.jvm.KotlinSignature'>
|
||||
<val name="value"
|
||||
val=""fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>""/>
|
||||
val=""fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>?""/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JetCodeBlockSelectioner : BasicSelectioner() {
|
||||
override fun canSelect(e: PsiElement)
|
||||
= e is JetBlockExpression || e is JetWhenExpression
|
||||
|
||||
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange> {
|
||||
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>? {
|
||||
val result = ArrayList<TextRange>()
|
||||
|
||||
val node = e.getNode()!!
|
||||
|
||||
@@ -34,10 +34,10 @@ public class JetListSelectioner : BasicSelectioner() {
|
||||
override fun canSelect(e: PsiElement)
|
||||
= e is JetParameterList || e is JetValueArgumentList || e is JetTypeParameterList || e is JetTypeArgumentList
|
||||
|
||||
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange> {
|
||||
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>? {
|
||||
val node = e.getNode()!!
|
||||
val startNode = node.findChildByType(TokenSet.create(JetTokens.LPAR, JetTokens.LT)) ?: return listOf()
|
||||
val endNode = node.findChildByType(TokenSet.create(JetTokens.RPAR, JetTokens.GT)) ?: return listOf()
|
||||
val startNode = node.findChildByType(TokenSet.create(JetTokens.LPAR, JetTokens.LT)) ?: return null
|
||||
val endNode = node.findChildByType(TokenSet.create(JetTokens.RPAR, JetTokens.GT)) ?: return null
|
||||
return listOf(TextRange(startNode.getStartOffset() + 1, endNode.getStartOffset()))
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -39,9 +39,9 @@ public class JetStatementGroupSelectioner : BasicSelectioner() {
|
||||
override fun canSelect(e: PsiElement)
|
||||
= e is JetExpression || e is JetWhenEntry
|
||||
|
||||
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange> {
|
||||
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>? {
|
||||
val parent = e.getParent()
|
||||
if (parent !is JetBlockExpression && parent !is JetWhenExpression) return listOf()
|
||||
if (parent !is JetBlockExpression && parent !is JetWhenExpression) return null
|
||||
|
||||
val startElement = e.siblings(forward = false, withItself = false)
|
||||
.firstOrNull { // find preceding '{' or blank line
|
||||
|
||||
Reference in New Issue
Block a user