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:
@@ -95,7 +95,7 @@ public struct AppContextDetector: Sendable {
|
||||
"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) })
|
||||
if hasIndentation, hasCodeKeyword {
|
||||
return .code
|
||||
|
||||
Reference in New Issue
Block a user