mirror of
https://github.com/chylex/IntelliJ-AceJump.git
synced 2025-04-12 07:15:43 +02:00
fixes #442
This commit is contained in:
parent
209b6c97b7
commit
f64e25a0a9
@ -3,9 +3,9 @@ import org.jetbrains.changelog.date
|
||||
|
||||
plugins {
|
||||
idea apply true
|
||||
kotlin("jvm") version "1.9.0"
|
||||
kotlin("jvm") version "1.9.10"
|
||||
id("org.jetbrains.intellij") version "1.15.0"
|
||||
id("org.jetbrains.changelog") version "2.1.2"
|
||||
id("org.jetbrains.changelog") version "2.2.0"
|
||||
id("com.github.ben-manes.versions") version "0.47.0"
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ tasks {
|
||||
}
|
||||
|
||||
runPluginVerifier {
|
||||
ideVersions = listOf("2023.1")
|
||||
ideVersions = listOf("2023.2")
|
||||
}
|
||||
|
||||
// Remove pending: https://youtrack.jetbrains.com/issue/IDEA-278926
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -70,7 +70,7 @@ internal class SearchProcessor private constructor(
|
||||
*/
|
||||
fun type(char: Char, tagger: Tagger): Boolean {
|
||||
val newQuery = query.rawText + char
|
||||
val canMatchTag = tagger.canQueryMatchAnyTag(newQuery)
|
||||
val canMatchTag = tagger.canQueryMatchAnyVisibleTag(newQuery)
|
||||
|
||||
// If the typed character is not compatible with any existing tag or as
|
||||
// a continuation of any previous occurrence, reject the query change
|
||||
|
@ -5,13 +5,10 @@ import com.google.common.collect.HashBiMap
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList
|
||||
import it.unimi.dsi.fastutil.ints.IntList
|
||||
import org.acejump.ExternalUsage
|
||||
import org.acejump.*
|
||||
import org.acejump.boundaries.EditorOffsetCache
|
||||
import org.acejump.boundaries.StandardBoundaries.VISIBLE_ON_SCREEN
|
||||
import org.acejump.immutableText
|
||||
import org.acejump.input.KeyLayoutCache.allPossibleTags
|
||||
import org.acejump.isWordPart
|
||||
import org.acejump.matchesAt
|
||||
import org.acejump.view.TagMarker
|
||||
import java.util.AbstractMap.SimpleImmutableEntry
|
||||
import kotlin.collections.component1
|
||||
@ -143,24 +140,23 @@ internal class Tagger(private val editors: List<Editor>) {
|
||||
}
|
||||
}
|
||||
|
||||
private infix fun Map.Entry<String, Tag>.solves(query: String): Boolean {
|
||||
return query.endsWith(key, true) && isTagCompatibleWithQuery(key, value, query)
|
||||
}
|
||||
private infix fun Map.Entry<String, Tag>.solves(query: String): Boolean =
|
||||
query.endsWith(key, true) && isTagCompatibleWithQuery(key, value, query)
|
||||
|
||||
private fun isTagCompatibleWithQuery(marker: String, tag: Tag, query: String): Boolean {
|
||||
return tag.editor.immutableText.matchesAt(tag.offset, getPlaintextPortion(query, marker), ignoreCase = true)
|
||||
}
|
||||
private fun isTagCompatibleWithQuery(marker: String, tag: Tag, query: String): Boolean =
|
||||
tag.editor.immutableText.matchesAt(tag.offset, getPlaintextPortion(query, marker), ignoreCase = true)
|
||||
|
||||
fun isQueryCompatibleWithTagAt(query: String, tag: Tag): Boolean {
|
||||
return tagMap.inverse()[tag].let { it != null && isTagCompatibleWithQuery(it, tag, query) }
|
||||
}
|
||||
fun isQueryCompatibleWithTagAt(query: String, tag: Tag): Boolean =
|
||||
tagMap.inverse()[tag].let { it != null && isTagCompatibleWithQuery(it, tag, query) }
|
||||
|
||||
fun canQueryMatchAnyTag(query: String): Boolean {
|
||||
return tagMap.any { (tag, offset) ->
|
||||
val tagPortion = getTagPortion(query, tag)
|
||||
tagPortion.isNotEmpty() && tag.startsWith(tagPortion, ignoreCase = true) && isTagCompatibleWithQuery(tag, offset, query)
|
||||
fun canQueryMatchAnyVisibleTag(query: String): Boolean =
|
||||
tagMap.any { (label, tag) ->
|
||||
val tagPortion = getTagPortion(query, label)
|
||||
tagPortion.isNotEmpty()
|
||||
&& label.startsWith(tagPortion, ignoreCase = true)
|
||||
&& isTagCompatibleWithQuery(label, tag, query)
|
||||
&& tag.offset in tag.editor.getView()
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeResultsWithOverlappingTags(editor: Editor, offsets: IntList) {
|
||||
val iter = offsets.iterator()
|
||||
|
Loading…
Reference in New Issue
Block a user