Skip to content

Commit edd9f91

Browse files
committed
Support scope shorthand
1 parent e389506 commit edd9f91

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Core/Sources/ChatContextCollector/ActiveDocumentChatContextCollector.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct ActiveDocumentChatContextCollector: ChatContextCollector {
1717
.replacingOccurrences(of: content.projectURL.path, with: "")
1818
let selectionRange = content.editorContent?.selections.first ?? .outOfScope
1919
let editorContent = {
20-
if scopes.contains("file") {
20+
if scopes.contains("file") || scopes.contains("f") {
2121
return """
2222
File Content:```\(content.language.rawValue)
2323
\(content.editorContent?.content ?? "")
@@ -57,7 +57,7 @@ public struct ActiveDocumentChatContextCollector: ChatContextCollector {
5757
"""
5858
}
5959

60-
if scopes.contains("selection") {
60+
if scopes.contains("selection") || scopes.contains("s") {
6161
return """
6262
Selected Code \
6363
(start from line \(selectionRange.start.line)):```\(content.language.rawValue)

Core/Sources/ChatContextCollectors/WebChatContextCollector/WebChatContextCollector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public final class WebChatContextCollector: ChatContextCollector {
1212
scopes: Set<String>,
1313
content: String
1414
) -> ChatContext? {
15-
guard scopes.contains("web") else { return nil }
15+
guard scopes.contains("web") || scopes.contains("w") else { return nil }
1616
let links = Self.detectLinks(from: history) + Self.detectLinks(from: content)
1717
let functions: [(any ChatGPTFunction)?] = [
1818
SearchFunction(),

0 commit comments

Comments
 (0)