File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -603,15 +603,18 @@ describe("VsCodeLmHandler", () => {
603603 ) . toEqual ( [ ] )
604604 } )
605605
606- it ( "keeps an incomplete invoke buffered when the cap passes a newline inside it" , async ( ) => {
606+ it . each ( [
607+ { where : "its parameter body" , separator : " " } ,
608+ { where : "its opening tag" , separator : "\n" } ,
609+ ] ) ( "keeps an incomplete invoke buffered when the cap passes a newline in $where" , async ( { separator } ) => {
607610 // The drain boundary was the first newline after the last closed block, even inside a
608611 // later open block. The filler trips the cap before that block's closing tag arrives.
609612 const padding = "p" . repeat ( 20 * 1024 )
610613 const filler = "x" . repeat ( 240 * 1024 )
611614 const openBody = `sub\n${ filler } `
612615 const chunks = await collect ( [
613616 `<function${ "_calls" } ><in${ "voke" } name="calculator"><parameter name="operation">${ padding } </parameter></in${ "voke" } > ` +
614- `<in${ "voke" } name="calculator"><parameter name="operation">sub\n` ,
617+ `<in${ "voke" } ${ separator } name="calculator"><parameter name="operation">sub\n` ,
615618 filler ,
616619 `</parameter></in${ "voke" } ></function${ "_calls" } >` ,
617620 ] )
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ function decidedSalvageEnd(text: string): number {
143143 return 0
144144 }
145145 // A newline inside a later, still-open block must not drain that block's opener as text.
146- const nextOpen = text . slice ( blockEnd , lineEnd ) . search ( / < (?: a n t m l : ) ? i n v o k e \s + n a m e = " / i)
146+ // Search past the newline: the opener itself may span it, as in `<invoke\nname="`.
147+ const nextOpen = text . slice ( blockEnd ) . search ( / < (?: a n t m l : ) ? i n v o k e \s + n a m e = " / i)
147148 return nextOpen === - 1 ? lineEnd + 1 : blockEnd + nextOpen
148149}
149150
You can’t perform that action at this time.
0 commit comments