correcty index escaped identifiers
#KT-8846 Fixed
This commit is contained in:
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.idea.search.usagesSearch.ALL_SEARCHABLE_OPERATIONS
|
|||||||
import org.jetbrains.kotlin.kdoc.lexer.KDocTokens
|
import org.jetbrains.kotlin.kdoc.lexer.KDocTokens
|
||||||
import org.jetbrains.kotlin.lexer.JetLexer
|
import org.jetbrains.kotlin.lexer.JetLexer
|
||||||
import org.jetbrains.kotlin.lexer.JetTokens
|
import org.jetbrains.kotlin.lexer.JetTokens
|
||||||
import java.util.ArrayDeque
|
import java.util.*
|
||||||
|
|
||||||
val KOTLIN_NAMED_ARGUMENT_SEARCH_CONTEXT: Short = 0x20
|
val KOTLIN_NAMED_ARGUMENT_SEARCH_CONTEXT: Short = 0x20
|
||||||
|
|
||||||
@@ -66,6 +66,15 @@ class KotlinFilterLexer(private val occurrenceConsumer: OccurrenceConsumer): Bas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JetTokens.IDENTIFIER -> {
|
||||||
|
if (myDelegate.tokenText.startsWith("`")) {
|
||||||
|
scanWordsInToken(UsageSearchContext.IN_CODE.toInt(), false, false)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addOccurrenceInToken(UsageSearchContext.IN_CODE.toInt())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
in codeTokens -> addOccurrenceInToken(UsageSearchContext.IN_CODE.toInt())
|
in codeTokens -> addOccurrenceInToken(UsageSearchContext.IN_CODE.toInt())
|
||||||
|
|
||||||
in JetTokens.STRINGS -> scanWordsInToken(UsageSearchContext.IN_STRINGS + UsageSearchContext.IN_FOREIGN_LANGUAGES, false, true)
|
in JetTokens.STRINGS -> scanWordsInToken(UsageSearchContext.IN_STRINGS + UsageSearchContext.IN_FOREIGN_LANGUAGES, false, true)
|
||||||
@@ -98,7 +107,7 @@ class KotlinFilterLexer(private val occurrenceConsumer: OccurrenceConsumer): Bas
|
|||||||
class KotlinIdIndexer: LexerBasedIdIndexer() {
|
class KotlinIdIndexer: LexerBasedIdIndexer() {
|
||||||
override fun createLexer(consumer: OccurrenceConsumer): Lexer = KotlinFilterLexer(consumer)
|
override fun createLexer(consumer: OccurrenceConsumer): Lexer = KotlinFilterLexer(consumer)
|
||||||
|
|
||||||
override fun getVersion() = 2
|
override fun getVersion() = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinTodoIndexer: LexerBasedTodoIndexer(), IdAndToDoScannerBasedOnFilterLexer {
|
class KotlinTodoIndexer: LexerBasedTodoIndexer(), IdAndToDoScannerBasedOnFilterLexer {
|
||||||
|
|||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package testing.rename
|
||||||
|
|
||||||
|
public open class C {
|
||||||
|
public fun second() = 1
|
||||||
|
|
||||||
|
public fun foo() = second()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package testing.rename
|
||||||
|
|
||||||
|
public open class C {
|
||||||
|
public fun `first`() = 1
|
||||||
|
|
||||||
|
public fun foo() = `first`()
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"type": "KOTLIN_FUNCTION",
|
||||||
|
"classId": "testing/rename/C",
|
||||||
|
"oldName": "first",
|
||||||
|
"newName": "second"
|
||||||
|
}
|
||||||
@@ -281,6 +281,12 @@ public class RenameTestGenerated extends AbstractRenameTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("renameKotlinMethodWithEscapedName/renameKotlinMethodWithEscapedName.test")
|
||||||
|
public void testRenameKotlinMethodWithEscapedName_RenameKotlinMethodWithEscapedName() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/rename/renameKotlinMethodWithEscapedName/renameKotlinMethodWithEscapedName.test");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("renameKotlinPackage/renameInOtherFile.test")
|
@TestMetadata("renameKotlinPackage/renameInOtherFile.test")
|
||||||
public void testRenameKotlinPackage_RenameInOtherFile() throws Exception {
|
public void testRenameKotlinPackage_RenameInOtherFile() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/rename/renameKotlinPackage/renameInOtherFile.test");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/rename/renameKotlinPackage/renameInOtherFile.test");
|
||||||
|
|||||||
Reference in New Issue
Block a user