@@ -275,7 +275,7 @@ public final class SuggestionWidgetController: NSObject {
275275
276276public extension SuggestionWidgetController {
277277 func suggestCode( fileURL: URL ) {
278- widgetViewModel. isProcessing = false
278+ widgetViewModel. endIsProcessing ( )
279279 Task {
280280 if let suggestion = await dataSource? . suggestionForFile ( at: fileURL) {
281281 suggestionPanelViewModel. content = . suggestion( suggestion)
@@ -285,24 +285,28 @@ public extension SuggestionWidgetController {
285285 }
286286
287287 func discardSuggestion( fileURL: URL ) {
288- widgetViewModel. isProcessing = false
288+ widgetViewModel. endIsProcessing ( )
289289 Task {
290290 await updateContentForActiveEditor ( fileURL: fileURL)
291291 }
292292 }
293293
294294 func markAsProcessing( _ isProcessing: Bool ) {
295- widgetViewModel. isProcessing = isProcessing
295+ if isProcessing {
296+ widgetViewModel. markIsProcessing ( )
297+ } else {
298+ widgetViewModel. endIsProcessing ( )
299+ }
296300 }
297301
298302 func presentError( _ errorDescription: String ) {
299303 suggestionPanelViewModel. content = . error( errorDescription)
300304 suggestionPanelViewModel. isPanelDisplayed = true
301- widgetViewModel. isProcessing = false
305+ widgetViewModel. endIsProcessing ( )
302306 }
303307
304308 func presentChatRoom( fileURL: URL ) {
305- widgetViewModel. isProcessing = false
309+ widgetViewModel. endIsProcessing ( )
306310 Task {
307311 if let chat = await dataSource? . chatForFile ( at: fileURL) {
308312 chatWindowViewModel. chat = chat
@@ -343,14 +347,14 @@ public extension SuggestionWidgetController {
343347 }
344348
345349 func closeChatRoom( fileURL: URL ) {
346- widgetViewModel. isProcessing = false
350+ widgetViewModel. endIsProcessing ( )
347351 Task {
348352 await updateContentForActiveEditor ( fileURL: fileURL)
349353 }
350354 }
351355
352356 func presentPromptToCode( fileURL: URL ) {
353- widgetViewModel. isProcessing = false
357+ widgetViewModel. endIsProcessing ( )
354358 Task {
355359 if let provider = await dataSource? . promptToCodeForFile ( at: fileURL) {
356360 suggestionPanelViewModel. content = . promptToCode( provider)
@@ -367,7 +371,7 @@ public extension SuggestionWidgetController {
367371 }
368372
369373 func discardPromptToCode( fileURL: URL ) {
370- widgetViewModel. isProcessing = false
374+ widgetViewModel. endIsProcessing ( )
371375 Task {
372376 await updateContentForActiveEditor ( fileURL: fileURL)
373377 }
0 commit comments