@@ -59,78 +59,3 @@ struct NoPromptToCodeCustomizedUI: PromptToCodeCustomizedUI {
5959 }
6060}
6161
62- public struct ModificationState : Equatable {
63- public typealias Source = ModificationAgentRequest . ModificationSource
64-
65- public var source : Source
66- public var history : [ ModificationHistoryNode ] = [ ]
67- public var snippets : IdentifiedArrayOf < ModificationSnippet > = [ ]
68- public var isGenerating : Bool = false
69- public var instruction : String
70- public var extraSystemPrompt : String
71- public var isAttachedToTarget : Bool = true
72-
73- public init (
74- source: Source ,
75- history: [ ModificationHistoryNode ] = [ ] ,
76- snippets: IdentifiedArrayOf < ModificationSnippet > ,
77- instruction: String ,
78- extraSystemPrompt: String ,
79- isAttachedToTarget: Bool
80- ) {
81- self . history = history
82- self . snippets = snippets
83- isGenerating = false
84- self . instruction = instruction
85- self . isAttachedToTarget = isAttachedToTarget
86- self . extraSystemPrompt = extraSystemPrompt
87- self . source = source
88- }
89-
90- public init (
91- source: Source ,
92- originalCode: String ,
93- attachedRange: CursorRange ,
94- instruction: String ,
95- extraSystemPrompt: String
96- ) {
97- self . init (
98- source: source,
99- snippets: [
100- . init(
101- startLineIndex: 0 ,
102- originalCode: originalCode,
103- modifiedCode: originalCode,
104- description: " " ,
105- error: nil ,
106- attachedRange: attachedRange
107- ) ,
108- ] ,
109- instruction: instruction,
110- extraSystemPrompt: extraSystemPrompt,
111- isAttachedToTarget: !attachedRange. isEmpty
112- )
113- }
114-
115- public mutating func popHistory( ) {
116- if !history. isEmpty {
117- let last = history. removeLast ( )
118- snippets = last. snippets
119- instruction = last. instruction
120- }
121- }
122-
123- public mutating func pushHistory( ) {
124- history. append ( . init( snippets: snippets, instruction: instruction) )
125- let oldSnippets = snippets
126- snippets = IdentifiedArrayOf ( )
127- for var snippet in oldSnippets {
128- snippet. originalCode = snippet. modifiedCode
129- snippet. modifiedCode = " "
130- snippet. description = " "
131- snippet. error = nil
132- snippets. append ( snippet)
133- }
134- }
135- }
136-
0 commit comments