Fix highlighting of TODO calls in lambdas

#KT-19915 Fixed
This commit is contained in:
Dmitry Jemerov
2017-12-19 15:46:06 +01:00
parent 0159d19539
commit 52ccfcecfc
3 changed files with 8 additions and 1 deletions
@@ -53,6 +53,7 @@ class KotlinTodoSearcher : QueryExecutorBase<IndexPatternOccurrence, IndexPatter
file.accept(object : KtTreeVisitorVoid() { file.accept(object : KtTreeVisitorVoid() {
override fun visitCallExpression(expression: KtCallExpression) { override fun visitCallExpression(expression: KtCallExpression) {
super.visitCallExpression(expression)
if (expression.calleeExpression?.text == "TODO") { if (expression.calleeExpression?.text == "TODO") {
consumer.process(KotlinTodoOccurrence(file, expression.textRange, pattern)) consumer.process(KotlinTodoOccurrence(file, expression.textRange, pattern))
} }
+5
View File
@@ -1,2 +1,7 @@
fun foo() = TODO("Fix me") fun foo() = TODO("Fix me")
fun bar() = TODO() fun bar() = TODO()
fun baz() {
run {
TODO("Fix me in lambda")
}
}
@@ -33,9 +33,10 @@ class TodoSearchTest : KotlinLightCodeInsightFixtureTestCase() {
fun testTodoCall() { fun testTodoCall() {
val file = myFixture.configureByFile("todoCall.kt") val file = myFixture.configureByFile("todoCall.kt")
val todoItems = PsiTodoSearchHelper.SERVICE.getInstance(myFixture.project).findTodoItems(file) val todoItems = PsiTodoSearchHelper.SERVICE.getInstance(myFixture.project).findTodoItems(file)
assertEquals(2, todoItems.size) assertEquals(3, todoItems.size)
verifyTodoItemText(todoItems[0], "TODO(\"Fix me\")") verifyTodoItemText(todoItems[0], "TODO(\"Fix me\")")
verifyTodoItemText(todoItems[1], "TODO()") verifyTodoItemText(todoItems[1], "TODO()")
verifyTodoItemText(todoItems[2], "TODO(\"Fix me in lambda\")")
} }
private fun verifyTodoItemText(todoItem: TodoItem, s: String) { private fun verifyTodoItemText(todoItem: TodoItem, s: String) {