davsclaus opened a new pull request, #27240:
URL: https://github.com/apache/camel/pull/27240

   Fixes [CAMEL-25243](https://issues.apache.org/jira/browse/CAMEL-25243), a 
follow-up of CAMEL-25241 (#27238) for two of the limitations it listed.
   
   **In an argument**, Tab completes the chain of the argument, walked from the 
route builder method it starts with:
   - `.filter(header("priority").` → `isEqualTo`, `isNotNull`, `contains`, 
`in`...
   - `.split(body().` → `tokenize`, `convertTo`, `regexReplaceAll`...
   - a predicate ends the chain (nothing offered after `isNotNull()`).
   
   **Chains that do not start with a route**:
   - the REST DSL: `rest("/api").`, `rest("/api").get("/orders").`, with 
`param()` ... `endParam()` and `responseMessage()`;
   - `restConfiguration().`, `routeTemplate("t").` with `templateBean(..)` ... 
`end()`, and builders such as `deadLetterChannel(..).`.
   
   ![argument 
completion](https://raw.githubusercontent.com/apache/camel/fix/CAMEL-25243/docs/user-manual/modules/ROOT/images/jbang/camel-tui-source-java-argument-completion.png)
   
   ### How
   - `JavaChainContext`: when the cursor is inside parentheses, the chain is 
read from the start of the argument (after its `(` or `,`, or after `;`/`{` in 
a lambda body inside it); `argument()` tells the two apart.
   - `JavaDslCompletions`: a chain may start with any route builder method 
returning a model or builder class. On a builder or a definition that is no 
route EIP (`ValueBuilder`, `RestDefinition`, `ParamDefinition`...) the walk 
follows the returned types, without blocks; a sub-builder whose `end()` returns 
its parent as a type parameter goes back to where it was entered. Getter-named 
methods stay out except fluent ones (`get()` of the REST DSL, `isNotNull()` 
making a predicate; `getExpression()` stays out). `evaluate` is no DSL.
   
   ### Recall
   The same scratch run as #27238 (not committed), by category, at every dot in 
the Java route tests of the repo:
   
   | Category | camel-core (2,500 files) | components (3,000 files, 191 
components) |
   |---|---|---|
   | route chains | 13,636 / 13,650 | 12,329 / 12,330 |
   | arguments | 4,387 / 4,405 | 1,948 / 1,957 |
   | REST, templates | **501 / 501** | **1,874 / 1,874** |
   | other starts (`deadLetterChannel`...) | 76 / 76 | 375 / 376 |
   
   The first run had REST at 59% (`get()` taken for a getter), arguments 
missing `isNotNull()` (same), and template beans lost at `end()`; all fixed 
here. What remains: deprecated methods, tests calling internals (`addOutput`, 
`getOutputs`, `setContinued`), and the fluent language builders 
(`expression().jsonpath().expression(..)`, 6 positions), now listed in the 
known limitations.
   
   ### Docs
   The Java entry of the completion section covers arguments and the REST DSL; 
the known limitations drop both and list what is still out (routes in 
variables, the code of lambdas and processors, fluent language builders, own 
builder methods). Help updated, and a screenshot.
   
   ### Testing
   - `JavaDslCompletionTest`: argument contexts, builder methods (and no 
internals), predicates ending the chain, REST verbs/params/configuration, a 
template bean going back on `end()`.
   - The `camel-jbang-plugin-tui` suite passes (1581 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]

Reply via email to