davsclaus opened a new pull request, #30032: URL: https://github.com/apache/camel/pull/30032
JIRA: [CAMEL-26933](https://issues.apache.org/jira/browse/CAMEL-26933), item 7. `CamelNanoLspEditor.insertHelp`, which applies the completion picked in `camel edit`, had three bugs, found by reading the code in the CLI scan: - **Text lost on insert:** without a text edit, the line was cut at the cursor, so the rest of the line was dropped. - **Multi-line edits:** the new text was indexed with the positions of the old lines, which lost text, or threw `StringIndexOutOfBoundsException` when the lines had other lengths. - **NPE on insert/replace edits:** an `InsertReplaceEdit` is the right side of the `Either`, and `getLeft()` was called without `isLeft()`. The edit is now applied by two small methods. `applyEdit` replaces the range with the new text, and the result may span lines. `insertAt` inserts and keeps the rest of the line. An insert/replace edit uses its replace range. Tests: `CamelNanoLspEditorTest`, the module's first tests (junit-jupiter and assertj as test dependencies): an insert in the middle of a line, an edit on one line, an edit over several lines, and an edit that adds lines. Not checked in a terminal with the editor. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
