diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/IndexPatternBuilderAdapter.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/IndexPatternBuilderAdapter.kt new file mode 100644 index 00000000000..795a1252aae --- /dev/null +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/IndexPatternBuilderAdapter.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2019 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.search + +import com.intellij.psi.impl.search.IndexPatternBuilder +import com.intellij.psi.tree.IElementType +import org.jetbrains.kotlin.lexer.KtTokens + +abstract class IndexPatternBuilderAdapter : IndexPatternBuilder { + override fun getCommentStartDelta(tokenType: IElementType, tokenText: CharSequence): Int { + return when (tokenType) { + KtTokens.EOL_COMMENT -> 2 + KtTokens.BLOCK_COMMENT -> 2 + KtTokens.DOC_COMMENT -> 3 + else -> 0 + } + } + + override fun getCharsAllowedInContinuationPrefix(tokenType: IElementType): String { + return when (tokenType) { + KtTokens.BLOCK_COMMENT -> "*" + KtTokens.DOC_COMMENT -> "*" + else -> "" + } + } +} \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/IndexPatternBuilderAdapter.kt.182 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/IndexPatternBuilderAdapter.kt.182 new file mode 100644 index 00000000000..183782c8191 --- /dev/null +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/IndexPatternBuilderAdapter.kt.182 @@ -0,0 +1,13 @@ +/* + * Copyright 2010-2019 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.search + +import com.intellij.psi.impl.search.IndexPatternBuilder +import com.intellij.psi.tree.IElementType +import org.jetbrains.kotlin.lexer.KtTokens + +abstract class IndexPatternBuilderAdapter : IndexPatternBuilder { +} \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexPatternBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexPatternBuilder.kt index 4982881fb37..257d89d7b0e 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexPatternBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexPatternBuilder.kt @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.lexer.KotlinLexer import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtFile -class KotlinIndexPatternBuilder: IndexPatternBuilder { +class KotlinIndexPatternBuilder: IndexPatternBuilderAdapter() { private val TODO_COMMENT_TOKENS = TokenSet.orSet(KtTokens.COMMENTS, TokenSet.create(KDocTokens.KDOC)) override fun getCommentTokenSet(file: PsiFile): TokenSet? { @@ -43,21 +43,4 @@ class KotlinIndexPatternBuilder: IndexPatternBuilder { KtTokens.BLOCK_COMMENT -> "*/".length else -> 0 } - - override fun getCommentStartDelta(tokenType: IElementType, tokenText: CharSequence): Int { - return when (tokenType) { - KtTokens.EOL_COMMENT -> 2 - KtTokens.BLOCK_COMMENT -> 2 - KtTokens.DOC_COMMENT -> 3 - else -> 0 - } - } - - override fun getCharsAllowedInContinuationPrefix(tokenType: IElementType): String { - return when (tokenType) { - KtTokens.BLOCK_COMMENT -> "*" - KtTokens.DOC_COMMENT -> "*" - else -> "" - } - } }