Skip to content

Commit 5aa488e

Browse files
committed
Specify the document URL when resolving the context
1 parent ae59139 commit 5aa488e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Core/Sources/SuggestionWidget/FeatureReducers/PromptToCodePanel.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ public struct PromptToCodePanel {
139139

140140
return .run { send in
141141
do {
142-
let context = await contextInputController.resolveContext(onStatusChange: {
143-
await send(.statusUpdated($0))
144-
})
142+
let context = await contextInputController.resolveContext(
143+
forDocumentURL: copiedState.promptToCodeState.source.documentURL,
144+
onStatusChange: { await send(.statusUpdated($0)) }
145+
)
145146
await send(.referencesUpdated(context.references))
146147
let agentFactory = context.agent ?? { SimpleModificationAgent() }
147148
_ = try await withThrowingTaskGroup(of: Void.self) { group in

Tool/Sources/PromptToCodeCustomization/PromptToCodeCustomization.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ public protocol PromptToCodeContextInputControllerDelegate {
5555
public protocol PromptToCodeContextInputController: Perception.Perceptible {
5656
var instruction: NSAttributedString { get set }
5757

58-
func resolveContext(onStatusChange: @escaping ([String]) async -> Void) async -> (
58+
func resolveContext(
59+
forDocumentURL: URL,
60+
onStatusChange: @escaping ([String]) async -> Void
61+
) async -> (
5962
instruction: String,
6063
references: [ChatMessage.Reference],
6164
topics: [ChatMessage.Reference],
@@ -100,7 +103,10 @@ public final class DefaultPromptToCodeContextInputController: PromptToCodeContex
100103
instruction = mutable
101104
}
102105

103-
public func resolveContext(onStatusChange: @escaping ([String]) async -> Void) -> (
106+
public func resolveContext(
107+
forDocumentURL: URL,
108+
onStatusChange: @escaping ([String]) async -> Void
109+
) -> (
104110
instruction: String,
105111
references: [ChatMessage.Reference],
106112
topics: [ChatMessage.Reference],

0 commit comments

Comments
 (0)