Procházet zdrojové kódy

no more lastprocessed index, because we are not streaming

Mark IJbema před 4 měsíci
rodič
revize
3115e18c65
1 změnil soubory, kde provedl 1 přidání a 8 odebrání
  1. 1 8
      src/services/ghost/GhostStreamingParser.ts

+ 1 - 8
src/services/ghost/GhostStreamingParser.ts

@@ -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
 	}