Skip to content

Commit 93257e8

Browse files
committed
Update modification to not always trigger immediately
1 parent 3388747 commit 93257e8

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

Core/Sources/Service/SuggestionCommandHandler/PseudoCommandHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ struct PseudoCommandHandler: CommandHandler {
284284
usesTabsForIndentation: filespace.codeMetadata.usesTabsForIndentation ?? false,
285285
commandName: nil,
286286
isContinuous: false
287-
))))
287+
), sendImmediately: false)))
288288
} catch {
289289
toast.toast(content: error.localizedDescription, type: .error)
290290
}

Core/Sources/SuggestionWidget/FeatureReducers/PromptToCodeGroup.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public struct PromptToCodeGroup {
3232
public enum Action {
3333
/// Activate the prompt to code if it exists or create it if it doesn't
3434
case activateOrCreatePromptToCode(PromptToCodePanel.State)
35-
case createPromptToCode(PromptToCodePanel.State)
35+
case createPromptToCode(PromptToCodePanel.State, sendImmediately: Bool)
3636
case updatePromptToCodeRange(
3737
id: PromptToCodePanel.State.ID,
3838
snippetId: UUID,
@@ -58,13 +58,13 @@ public struct PromptToCodeGroup {
5858
}
5959
}
6060
return .run { send in
61-
await send(.createPromptToCode(s))
61+
await send(.createPromptToCode(s, sendImmediately: false))
6262
}
63-
case let .createPromptToCode(newPromptToCode):
63+
case let .createPromptToCode(newPromptToCode, sendImmediately):
6464
// insert at 0 so it has high priority then the other detached prompt to codes
6565
state.promptToCodes.insert(newPromptToCode, at: 0)
6666
return .run { send in
67-
if !newPromptToCode.promptToCodeState.instruction.isEmpty {
67+
if sendImmediately, !newPromptToCode.promptToCodeState.instruction.isEmpty {
6868
await send(.promptToCode(newPromptToCode.id, .modifyCodeButtonTapped))
6969
}
7070
}.cancellable(

Core/Sources/SuggestionWidget/FeatureReducers/WidgetPanel.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ public struct WidgetPanel {
7878

7979
case let .presentPromptToCode(initialState):
8080
return .run { send in
81-
await send(.sharedPanel(.promptToCodeGroup(.createPromptToCode(initialState))))
81+
await send(.sharedPanel(.promptToCodeGroup(.createPromptToCode(
82+
initialState,
83+
sendImmediately: true
84+
))))
8285
}
8386

8487
case .displayPanelContent:

0 commit comments

Comments
 (0)