diff --git a/src/main/kotlin/com/viartemev/requestmapper/RequestMappingContributor.kt b/src/main/kotlin/com/viartemev/requestmapper/RequestMappingContributor.kt index 1ddb4685..b58ac27c 100644 --- a/src/main/kotlin/com/viartemev/requestmapper/RequestMappingContributor.kt +++ b/src/main/kotlin/com/viartemev/requestmapper/RequestMappingContributor.kt @@ -21,8 +21,9 @@ class RequestMappingContributor(private val annotationSearcher: (string: String, } override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array { + val normalizedName = name.replace("\\s+".toRegex(), " ").trim() return navigationItems - .filter { it.name == name } + .filter { it.name == normalizedName } .toTypedArray() } diff --git a/src/main/kotlin/com/viartemev/requestmapper/RequestMappingModel.kt b/src/main/kotlin/com/viartemev/requestmapper/RequestMappingModel.kt index b3fc8fe2..d4814414 100644 --- a/src/main/kotlin/com/viartemev/requestmapper/RequestMappingModel.kt +++ b/src/main/kotlin/com/viartemev/requestmapper/RequestMappingModel.kt @@ -35,15 +35,16 @@ class RequestMappingModel(project: Project) : FilteringGotoByModel(pro override fun willOpenEditor(): Boolean = false override fun matches(popupItem: String, userPattern: String): Boolean { - return if (userPattern == "/") { + val normalizedUserPattern = userPattern.replace("\\s+".toRegex(), " ").trim() + return if (normalizedUserPattern == "/") { true - } else if (!userPattern.contains('/')) { + } else if (!normalizedUserPattern.contains('/')) { val (method, path) = popupItem.split(" ", limit = 2) - path.contains(userPattern) || method.contains(userPattern, ignoreCase = true) + path.contains(normalizedUserPattern) || method.contains(normalizedUserPattern, ignoreCase = true) } else { Path.isSubpathOf( PopupPath(popupItem).toPath(), - RequestedUserPath(userPattern).toPath() + RequestedUserPath(normalizedUserPattern).toPath() ) } }