|
|
@@ -203,7 +203,6 @@ function mapNormalizedToOriginalIndex(
|
|
|
export class GhostStreamingParser {
|
|
|
public buffer: string = ""
|
|
|
private completedChanges: ParsedChange[] = []
|
|
|
- private lastProcessedIndex: number = 0
|
|
|
private context: GhostSuggestionContext | null = null
|
|
|
private streamFinished: boolean = false
|
|
|
|
|
|
@@ -223,7 +222,6 @@ export class GhostStreamingParser {
|
|
|
public reset(): void {
|
|
|
this.buffer = ""
|
|
|
this.completedChanges = []
|
|
|
- this.lastProcessedIndex = 0
|
|
|
this.streamFinished = false
|
|
|
}
|
|
|
|
|
|
@@ -300,7 +298,7 @@ export class GhostStreamingParser {
|
|
|
const newChanges: ParsedChange[] = []
|
|
|
|
|
|
// Look for complete <change> blocks starting from where we left off
|
|
|
- const searchText = this.buffer.substring(this.lastProcessedIndex)
|
|
|
+ const searchText = this.buffer
|
|
|
|
|
|
// Updated regex to handle both single-line XML format and traditional format with whitespace
|
|
|
const changeRegex =
|
|
|
@@ -325,11 +323,6 @@ export class GhostStreamingParser {
|
|
|
lastMatchEnd = match.index + match[0].length
|
|
|
}
|
|
|
|
|
|
- // Update our processed index to avoid re-processing the same content
|
|
|
- if (lastMatchEnd > 0) {
|
|
|
- this.lastProcessedIndex += lastMatchEnd
|
|
|
- }
|
|
|
-
|
|
|
return newChanges
|
|
|
}
|
|
|
|