davsclaus opened a new pull request, #27232: URL: https://github.com/apache/camel/pull/27232
Fixes [CAMEL-25219](https://issues.apache.org/jira/browse/CAMEL-25219). The source editor completed endpoint uris; simple expressions, where models and humans make most mistakes, got nothing. Now **Tab** completes them in YAML, Java and XML routes alike. The context is read from the line alone (like the uri completion of CAMEL-25208), so it works while the file does not parse. | Where the cursor is | What Tab lists | |---|---| | after `${` | the 154 functions of the simple language from the catalog, with parameters and examples in the details panel. Inserted the way their examples write them: `body}`, `header.`, `date:`, `random(`, `uuid()}` (the catalog names `date(command)`, `bean(name.method)` are not the syntax, so they are listed as `date:command`, `bean:name.method`) | | after `${header.` / `${headers['` | the names the file sets or reads (`setHeader` in Java, YAML, XML; `${header.x}`), then the headers of the components the file uses (kafka → `CamelKafkaKey`...). Choosing `header.` opens this list right away. Same for `exchangeProperty.` and `variable.` | | after `${...} ` | the operators: comparisons and `&&` `\|\|` where the EIP takes a predicate, `~>` `?~>` `?:` in other expressions. The predicate EIPs come from the catalog (`asPredicate`: when, filter, validate, onWhen, handled, retryWhile, completionPredicate...) |  ### Changes - `SimpleCompletionContext`: the line-based context (function, name, operator) and the words before the expression, nearest first, to tell a predicate. - `SimpleCompletions`: the catalog-driven items; the predicate/EIP word sets are cached per catalog. - `SourceViewer` / `SourceTab`: a new completion hook, tried before the others in every route file. - `AutocompletePopup`: an optional insert text per item, multi-line details, and full keys (`header.name` was shown as `name`, as a grouped property key). - Help (`source.md`), the source editor doc page and a screenshot. ### Notes - Markers on file open, listed as a follow-up in CAMEL-25208, already landed in #27200. - Not in this PR: quick doc of the function under the cursor, and values after `${date:` (now, exchangeCreated...). ### Testing - `SimpleCompletionTest`: the context, insert texts, predicate detection in all three DSLs, file and component header names, the popup display, and Tab + Enter end to end in Java, YAML and XML files. - The `camel-jbang-plugin-tui` suite passes (1551 tests). - Tried live in the TUI: the screenshot is from that run. _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]
