mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-30 21:49:53 +00:00
small fixes
This commit is contained in:
parent
cfdd687216
commit
795b369219
7 changed files with 13 additions and 24 deletions
|
|
@ -34,9 +34,9 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
|
|||
lines := strings.Split(string(content), lineEnding)
|
||||
|
||||
// Check for overlapping edits
|
||||
for i := 0; i < len(edits); i++ {
|
||||
for i, edit1 := range edits {
|
||||
for j := i + 1; j < len(edits); j++ {
|
||||
if rangesOverlap(edits[i].Range, edits[j].Range) {
|
||||
if rangesOverlap(edit1.Range, edits[j].Range) {
|
||||
return fmt.Errorf("overlapping edits detected between edit %d and %d", i, j)
|
||||
}
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
|
|||
|
||||
// Apply each edit
|
||||
for _, edit := range sortedEdits {
|
||||
newLines, err := applyTextEdit(lines, edit, lineEnding)
|
||||
newLines, err := applyTextEdit(lines, edit)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to apply edit: %w", err)
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func applyTextEdit(lines []string, edit protocol.TextEdit, lineEnding string) ([]string, error) {
|
||||
func applyTextEdit(lines []string, edit protocol.TextEdit) ([]string, error) {
|
||||
startLine := int(edit.Range.Start.Line)
|
||||
endLine := int(edit.Range.End.Line)
|
||||
startChar := int(edit.Range.Start.Character)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue