Remove incorrect argument count check from TODO searcher

This commit is contained in:
Dmitry Jemerov
2017-05-23 18:21:01 +02:00
parent 970dfd10d4
commit 4f08d2b16a
3 changed files with 10 additions and 6 deletions
@@ -54,10 +54,7 @@ class KotlinTodoSearcher : QueryExecutorBase<IndexPatternOccurrence, IndexPatter
file.accept(object : KtTreeVisitorVoid() {
override fun visitCallExpression(expression: KtCallExpression) {
if (expression.calleeExpression?.text == "TODO") {
val argList = expression.valueArgumentList
if (argList?.arguments?.size == 1) {
consumer.process(KotlinTodoOccurrence(file, expression.textRange, pattern))
}
consumer.process(KotlinTodoOccurrence(file, expression.textRange, pattern))
}
}
})
+1
View File
@@ -1 +1,2 @@
fun foo() = TODO("Fix me")
fun bar() = TODO()
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.search
import com.intellij.psi.search.PsiTodoSearchHelper
import com.intellij.psi.search.TodoItem
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
@@ -32,8 +33,13 @@ class TodoSearchTest : KotlinLightCodeInsightFixtureTestCase() {
fun testTodoCall() {
val file = myFixture.configureByFile("todoCall.kt")
val todoItems = PsiTodoSearchHelper.SERVICE.getInstance(myFixture.project).findTodoItems(file)
assertEquals(1, todoItems.size)
assertEquals("TODO(\"Fix me\")", todoItems[0].textRange.substring(todoItems[0].file.text))
assertEquals(2, todoItems.size)
verifyTodoItemText(todoItems[0], "TODO(\"Fix me\")")
verifyTodoItemText(todoItems[1], "TODO()")
}
private fun verifyTodoItemText(todoItem: TodoItem, s: String) {
assertEquals(s, todoItem.textRange.substring(todoItem.file.text))
}
fun testTodoDef() {