@@ -136,14 +136,6 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
136136 defer { presenter. markAsProcessing ( false ) }
137137 let fileURL = try await Environment . fetchCurrentFileURL ( )
138138
139- let dataSource = Service . shared. guiController. widgetDataSource
140-
141- if await dataSource. promptToCodes [ fileURL] ? . promptToCodeService != nil {
142- await dataSource. removePromptToCode ( for: fileURL)
143- presenter. closePromptToCode ( fileURL: fileURL)
144- return
145- }
146-
147139 let ( workspace, _) = try await Service . shared. workspacePool
148140 . fetchOrCreateWorkspaceAndFilespace ( fileURL: fileURL)
149141 workspace. rejectSuggestion ( forFileAt: fileURL, editor: editor)
@@ -164,8 +156,6 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
164156 var cursorPosition = editor. cursorPosition
165157 var extraInfo = SuggestionInjector . ExtraInfo ( )
166158
167- let dataSource = Service . shared. guiController. widgetDataSource
168-
169159 if let acceptedSuggestion = workspace. acceptSuggestion (
170160 forFileAt: fileURL,
171161 editor: editor
@@ -202,7 +192,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
202192
203193 let dataSource = Service . shared. guiController. widgetDataSource
204194
205- if let service = await dataSource. promptToCodes [ fileURL ] ? . promptToCodeService {
195+ if let service = await dataSource. promptToCode ? . promptToCodeService {
206196 let rangeStart = service. selectionRange? . start ?? editor. cursorPosition
207197
208198 let suggestion = CodeSuggestion (
@@ -230,7 +220,7 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
230220 )
231221 presenter. presentPromptToCode ( fileURL: fileURL)
232222 } else {
233- await dataSource. removePromptToCode ( for : fileURL )
223+ await dataSource. removePromptToCode ( )
234224 presenter. closePromptToCode ( fileURL: fileURL)
235225 }
236226
0 commit comments