fix: check indentation with substring contains, not per-character

contains(where:) on String iterates Characters; comparing each to
multi-character strings like "\n    " is a type error. Use
tail.contains("\n    ") || tail.contains("\t") instead.

Co-authored-by: Rocky <hkgood@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-07-03 08:14:50 +00:00
parent 79a8df84b3
commit 3f60436d84
@@ -95,7 +95,7 @@ public struct AppContextDetector: Sendable {
"if (", "if (", "} else", "} catch", "if (", "if (", "} else", "} catch",
"=> {", "-> {", "=> {", "-> {",
] ]
let hasIndentation = tail.contains(where: { $0 == "\n " || $0 == "\t" }) let hasIndentation = tail.contains("\n ") || tail.contains("\t")
let hasCodeKeyword = codeKeywords.contains(where: { tail.contains($0) }) let hasCodeKeyword = codeKeywords.contains(where: { tail.contains($0) })
if hasIndentation, hasCodeKeyword { if hasIndentation, hasCodeKeyword {
return .code return .code