Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
working through structural edits fixes for evals
Dane Schneider576f5599a50a
diff --git a/app/server/syntax/structural_edits.go b/app/server/syntax/structural_edits.goindex e921c3af..9966e05a 100644--- a/app/server/syntax/structural_edits.go+++ b/app/server/syntax/structural_edits.go@@ -158,18 +158,11 @@ func ApplyReferences(}var oLineNum int = 0-- setOLineNum := func(n int) {- oLineNum = n- if verboseLogging {- fmt.Printf("setting oLineNum: %d\n", oLineNum)- }- }-var refOpen boolvar refStart intvar refOriginalParent *tree_sitter.Nodevar postRefBuffers []strings.Builder+closingLinesByPLineNum := map[int]int{}var noMatchUntilStructureClose stringdepth := 0@@ -180,6 +173,13 @@ func ApplyReferences(lastLineMatched := true+ setOLineNum := func(n int) {+ oLineNum = n+ if verboseLogging {+ fmt.Printf("setting oLineNum: %d\n", oLineNum)+ }+ }+writeToLatestPostRefBuffer := func(s string) {latestBuffer := &postRefBuffers[len(postRefBuffers)-1]latestBuffer.WriteString(s)@@ -319,6 +319,13 @@ func ApplyReferences(if isRef {if !refOpen {+ if verboseLogging {+ fmt.Println("isRef - opening ref")+ pnode := proposedNodesByLine[idx]+ fmt.Printf("pnode.Type(): %s\n", pnode.Type())+ fmt.Printf("pnode.Content(proposedBytes):\n%q\n", pnode.Content(proposedBytes))+ }+refOpen = truesetOLineNum(oLineNum + 1)refStart = oLineNum@@ -360,6 +367,11 @@ func ApplyReferences(var matching boolisClosingAnchor := closingLinesByPLineNum[pLineNum] != 0+ if verboseLogging {+ fmt.Printf("currentPNode != nil: %v\n", currentPNode != nil)+ fmt.Printf("currentPNodeMatches: %v\n", currentPNodeMatches)+ }+if isClosingAnchor {if verboseLogging {fmt.Printf("isClosingAnchor: %v\n", isClosingAnchor)@@ -415,14 +427,17 @@ func ApplyReferences(}}- if pNodeStartsThisLine && pNodeMultiline && currentPNode == nil {+ if pNodeStartsThisLine && pNodeMultiline && (currentPNode == nil || matching != currentPNodeMatches) {if verboseLogging {fmt.Printf("setting currentPNode: %s\n", pNode.Type())fmt.Printf("pNodeEndsAtIdx: %d\n", pNodeEndsAtIdx)+ fmt.Printf("content: %q\n", pNode.Content(proposedBytes))+ fmt.Println(pNode)}currentPNode = pNodecurrentPNodeEndsAtIdx = pNodeEndsAtIdxcurrentPNodeMatches = matching+}wroteRefs := false