tagQueryAt decides in one check, within detekt's return limit
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 3s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Skipped
Desktop (Tauri) / Tauri desktop (Linux) (push) Skipped
Desktop (Tauri) / Windows installer (cross-compiled) (push) Skipped
Desktop (Tauri) / Update manifest (push) Skipped
CI & Build / Web typecheck and unit tests (push) Successful in 9s
CI & Build / Python tests (push) Successful in 12s
Android / Core and FFI clippy and tests (push) Successful in 25s
CI & Build / integration (push) Successful in 1m29s
CI & Build / Build & push image (push) Skipped
Android / Kotlin + Rust (APK) (push) Successful in 6m56s
Android / Build the server image (push) Successful in 1s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 3s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Skipped
Desktop (Tauri) / Tauri desktop (Linux) (push) Skipped
Desktop (Tauri) / Windows installer (cross-compiled) (push) Skipped
Desktop (Tauri) / Update manifest (push) Skipped
CI & Build / Web typecheck and unit tests (push) Successful in 9s
CI & Build / Python tests (push) Successful in 12s
Android / Core and FFI clippy and tests (push) Successful in 25s
CI & Build / integration (push) Successful in 1m29s
CI & Build / Build & push image (push) Skipped
Android / Kotlin + Rust (APK) (push) Successful in 6m56s
Android / Build the server image (push) Successful in 1s
Task #6316. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,14 +37,16 @@ fun tagQueryAt(
|
|||||||
text: String,
|
text: String,
|
||||||
caret: Int,
|
caret: Int,
|
||||||
): TagQuery? {
|
): TagQuery? {
|
||||||
if (caret < 0 || caret > text.length) return null
|
|
||||||
var i = caret
|
var i = caret
|
||||||
while (i > 0 && text[i - 1].isTagChar()) i--
|
while (i > 0 && text[i - 1].isTagChar()) i--
|
||||||
if (i == 0 || text[i - 1] != '#') return null
|
|
||||||
val hash = i - 1
|
val hash = i - 1
|
||||||
if (hash > 0 && !text[hash - 1].isWhitespace()) return null
|
|
||||||
val query = text.substring(i, caret)
|
val query = text.substring(i, caret)
|
||||||
if (query.isNotEmpty() && !Character.isAlphabetic(query[0].code)) return null
|
val inTag =
|
||||||
|
hash >= 0 &&
|
||||||
|
text[hash] == '#' &&
|
||||||
|
(hash == 0 || text[hash - 1].isWhitespace()) &&
|
||||||
|
(query.isEmpty() || Character.isAlphabetic(query[0].code))
|
||||||
|
if (!inTag) return null
|
||||||
var end = caret
|
var end = caret
|
||||||
while (end < text.length && text[end].isTagChar()) end++
|
while (end < text.length && text[end].isTagChar()) end++
|
||||||
return TagQuery(start = hash, end = end, query = query)
|
return TagQuery(start = hash, end = end, query = query)
|
||||||
|
|||||||
Reference in New Issue
Block a user