Skip to content

Commit 2a46d5e

Browse files
committed
Adjust behavior of auto complete
1 parent 16a454a commit 2a46d5e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Core/Sources/SuggestionWidget/SuggestionPanelContent/ChatPanel.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,15 @@ struct ChatPanelInputArea: View {
400400
}
401401

402402
func chatAutoCompletion(text: String, proposed: [String], range: NSRange) -> [String] {
403-
if text.isEmpty { return [] }
403+
guard text.count == 1 else { return [] }
404404
let plugins = chat.pluginIdentifiers.map { "/\($0)" }
405405
let availableFeatures = plugins + [
406406
"/exit",
407407
"@selection",
408408
"@file",
409409
]
410-
return availableFeatures
410+
411+
let result: [String] = availableFeatures
411412
.filter { $0.hasPrefix(text) && $0 != text }
412413
.compactMap {
413414
guard let index = $0.index(
@@ -417,6 +418,7 @@ struct ChatPanelInputArea: View {
417418
) else { return nil }
418419
return String($0[index...])
419420
}
421+
return result
420422
}
421423
}
422424

0 commit comments

Comments
 (0)