Skip to content

Commit ab3be0d

Browse files
committed
Fix that prompt to code can open at launch
1 parent 65e603e commit ab3be0d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Core/Sources/SuggestionWidget/FeatureReducers/PromptToCodeGroup.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import ComposableArchitecture
2+
import Environment
23
import Foundation
34
import PromptToCodeService
45
import SuggestionModel
5-
import Environment
6+
import XcodeInspector
67

78
public struct PromptToCodeGroup: ReducerProtocol {
89
public struct State: Equatable {
910
public var promptToCodes: IdentifiedArrayOf<PromptToCode.State> = []
10-
public var activeDocumentURL: PromptToCode.State.ID?
11+
public var activeDocumentURL: PromptToCode.State.ID? = XcodeInspector.shared
12+
.realtimeActiveDocumentURL
1113
public var activePromptToCode: PromptToCode.State? {
1214
get {
1315
if let detached = promptToCodes.first(where: { !$0.isAttachedToSelectionRange }) {

Core/Sources/SuggestionWidget/FeatureReducers/WidgetFeature.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ public struct WidgetFeature: ReducerProtocol {
331331

332332
return .run { send in
333333
await send(.observeEditorChange)
334+
await send(.panel(.switchToAnotherEditorAndUpdateContent))
334335

335336
for await notification in notifications {
336337
try Task.checkCancellation()

0 commit comments

Comments
 (0)