Skip to content

Commit e2dea79

Browse files
committed
Move ActiveDocumentChatContextCollector to Tool
1 parent 60f4ff5 commit e2dea79

File tree

14 files changed

+43
-34
lines changed

14 files changed

+43
-34
lines changed

Core/Package.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ let package = Package(
210210

211211
// context collectors
212212
"WebChatContextCollector",
213-
"ActiveDocumentChatContextCollector",
214213
"SystemInfoChatContextCollector",
215214

216215
.product(name: "ChatContextCollector", package: "Tool"),
@@ -354,23 +353,6 @@ let package = Package(
354353
],
355354
path: "Sources/ChatContextCollectors/SystemInfoChatContextCollector"
356355
),
357-
358-
.target(
359-
name: "ActiveDocumentChatContextCollector",
360-
dependencies: [
361-
.product(name: "ChatContextCollector", package: "Tool"),
362-
.product(name: "OpenAIService", package: "Tool"),
363-
.product(name: "Preferences", package: "Tool"),
364-
.product(name: "FocusedCodeFinder", package: "Tool"),
365-
.product(name: "AppMonitoring", package: "Tool"),
366-
],
367-
path: "Sources/ChatContextCollectors/ActiveDocumentChatContextCollector"
368-
),
369-
370-
.testTarget(
371-
name: "ActiveDocumentChatContextCollectorTests",
372-
dependencies: ["ActiveDocumentChatContextCollector"]
373-
),
374356
]
375357
)
376358

Core/Sources/ChatService/AllContextCollector.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import WebChatContextCollector
66
import ProChatContextCollectors
77
let allContextCollectors: [any ChatContextCollector] = [
88
SystemInfoChatContextCollector(),
9-
ActiveDocumentChatContextCollector(),
109
WebChatContextCollector(),
1110
ProChatContextCollectors(),
1211
]

Pro

Submodule Pro updated from 8dc9244 to 52befe0

Tool/Package.swift

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ let package = Package(
1515
.library(name: "Logger", targets: ["Logger"]),
1616
.library(name: "OpenAIService", targets: ["OpenAIService"]),
1717
.library(name: "ChatTab", targets: ["ChatTab"]),
18-
.library(name: "ChatContextCollector", targets: ["ChatContextCollector"]),
18+
.library(
19+
name: "ChatContextCollector",
20+
targets: ["ChatContextCollector", "ActiveDocumentChatContextCollector"]
21+
),
1922
.library(name: "Environment", targets: ["Environment"]),
2023
.library(name: "SuggestionModel", targets: ["SuggestionModel"]),
2124
.library(name: "ASTParser", targets: ["ASTParser"]),
@@ -70,7 +73,7 @@ let package = Package(
7073
// MARK: - Helpers
7174

7275
.target(name: "XPCShared", dependencies: ["SuggestionModel"]),
73-
76+
7477
.target(name: "Configs"),
7578

7679
.target(name: "Preferences", dependencies: ["Configs", "AIModel"]),
@@ -234,14 +237,6 @@ let package = Package(
234237
]
235238
),
236239

237-
.target(
238-
name: "ChatContextCollector",
239-
dependencies: [
240-
"SuggestionModel",
241-
"OpenAIService",
242-
]
243-
),
244-
245240
.target(name: "BingSearchService"),
246241

247242
.target(name: "SuggestionService", dependencies: [
@@ -310,6 +305,33 @@ let package = Package(
310305
)]
311306
),
312307

308+
// MARK: - Chat Context Collector
309+
310+
.target(
311+
name: "ChatContextCollector",
312+
dependencies: [
313+
"SuggestionModel",
314+
"OpenAIService",
315+
]
316+
),
317+
318+
.target(
319+
name: "ActiveDocumentChatContextCollector",
320+
dependencies: [
321+
"ChatContextCollector",
322+
"OpenAIService",
323+
"Preferences",
324+
"FocusedCodeFinder",
325+
"XcodeInspector",
326+
],
327+
path: "Sources/ChatContextCollectors/ActiveDocumentChatContextCollector"
328+
),
329+
330+
.testTarget(
331+
name: "ActiveDocumentChatContextCollectorTests",
332+
dependencies: ["ActiveDocumentChatContextCollector"]
333+
),
334+
313335
// MARK: - Tests
314336

315337
.testTarget(

Tool/Sources/ChatContextCollector/ChatContextCollector.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@ import OpenAIService
44
public struct ChatContext {
55
public struct RetrievedContent {
66
public enum Priority: Equatable, Comparable {
7+
case bottom
78
case low
89
case medium
910
case high
11+
case top
1012
case custom(Int)
1113

1214
public var rawValue: Int {
1315
switch self {
16+
case .bottom:
17+
return 0
1418
case .low:
15-
return 20
19+
return 400
1620
case .medium:
17-
return 60
21+
return 600
1822
case .high:
19-
return 80
23+
return 800
24+
case .top:
25+
return 1_000_000_000
2026
case let .custom(value):
2127
return value
2228
}

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/ActiveDocumentChatContextCollector.swift renamed to Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/ActiveDocumentChatContextCollector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import XcodeInspector
1010
public final class ActiveDocumentChatContextCollector: ChatContextCollector {
1111
public init() {}
1212

13-
var activeDocumentContext: ActiveDocumentContext?
13+
public var activeDocumentContext: ActiveDocumentContext?
1414

1515
public func generateContext(
1616
history: [ChatMessage],

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/ExpandFocusRangeFunction.swift renamed to Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/ExpandFocusRangeFunction.swift

File renamed without changes.

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/MoveToCodeAroundLineFunction.swift renamed to Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/MoveToCodeAroundLineFunction.swift

File renamed without changes.

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/MoveToFocusedCodeFunction.swift renamed to Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/MoveToFocusedCodeFunction.swift

File renamed without changes.

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/GetEditorInfo.swift renamed to Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/GetEditorInfo.swift

File renamed without changes.

0 commit comments

Comments
 (0)