summaryrefslogtreecommitdiffhomepage
path: root/internal/lsp/util
diff options
context:
space:
mode:
authorKujtim Hoxha <[email protected]>2025-04-03 17:36:40 +0200
committerKujtim Hoxha <[email protected]>2025-04-03 17:38:28 +0200
commit795b3692197acf75ff13ed8a14c9a11d4b32ec5f (patch)
tree186dfea8eb2aa1f87a9960f415ac852f3768982e /internal/lsp/util
parentcfdd687216799cb5b47f099f1e7cd5dd16b3bdd0 (diff)
downloadopencode-795b3692197acf75ff13ed8a14c9a11d4b32ec5f.tar.gz
opencode-795b3692197acf75ff13ed8a14c9a11d4b32ec5f.zip
small fixes
Diffstat (limited to 'internal/lsp/util')
-rw-r--r--internal/lsp/util/edit.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/lsp/util/edit.go b/internal/lsp/util/edit.go
index 180429ce5..3b94fb39f 100644
--- a/internal/lsp/util/edit.go
+++ b/internal/lsp/util/edit.go
@@ -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)