[
https://issues.apache.org/jira/browse/CAMEL-24372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-24372:
--------------------------------
Description:
The TUI Source tab YAML editor currently supports basic character-level editing
(insert, delete, cursor movement, auto-indent, Tab completion, validate on
save). Several common editor operations are missing that would elevate it from
a basic text editor into a proper low-code tool for Camel routes.
The key insight is that operations like move, duplicate, and delete should be
*YAML-structure-aware* -- operating on entire EIP/node blocks rather than
single lines. In YAML DSL, a single EIP step is often multiple lines:
{code:yaml}
steps:
- setHeader:
name: foo
simple: "${body}"
- to:
uri: kafka:myTopic
parameters:
brokers: localhost:9092
- log:
message: "Done"
{code}
Moving one line at a time is not useful here. What users need is to move the
entire {{- setHeader:}} block (all 3 lines) as a unit, swapping it with the
adjacent sibling {{- to:}} block (all 4 lines). Block boundaries can be
detected from the {{- }} list item prefix and indentation level.
The editor already has the YAML DSL model from the catalog for Tab completion,
so it has structural awareness to know where blocks start and end.
h3. YAML DSL editing (block-aware)
# *Undo / Redo* (Ctrl+Z / Ctrl+Shift+Z) -- needs an undo stack in TextAreaState
or SourceViewer
# *Move EIP block up/down* (Alt+Up / Alt+Down) -- swap entire sibling blocks,
not single lines
# *Duplicate EIP block* (Ctrl+D) -- duplicate the whole block, useful for
adding similar steps
# *Delete EIP block* (Ctrl+Shift+K) -- delete the entire block at once
# *Word-level navigation* (Ctrl+Left / Ctrl+Right / Ctrl+Backspace) -- jump and
delete by word
# *Smart Home* -- first press goes to first non-whitespace, second press to
column 0
# *Find in edit mode* (Ctrl+F) -- search exists in view mode but not while
editing
# *Comment toggle* (Ctrl+/) -- add/remove # prefix on current line or block
h3. application.properties editing
Properties files are line-oriented so standard line-level operations work fine
here.
# *Comment toggle* (Ctrl+/) -- the #1 operation in properties files. Comment
out a property to disable it, uncomment to re-enable. Users do this constantly
when experimenting with configuration.
# *Value completion* -- Tab completion already works for property keys, but
offering completions for values would be very useful: boolean (true/false),
enum-typed options (e.g. {{camel.main.profile=}} offering dev/prod), duration
format hints (10s, 5m, 1h), component schemes.
# *Duplicate line* (Ctrl+D) -- handy when adding similar properties.
# *Delete line* (Ctrl+Shift+K) -- quick removal of a property.
# *Inline value validation* -- key validation exists on save, but validating
values (wrong type, invalid enum, malformed duration) would catch mistakes
earlier.
Note: Undo/Redo and Comment toggle apply to both YAML and properties files.
was:
The TUI Source tab YAML editor currently supports basic character-level editing
(insert, delete, cursor movement, auto-indent, Tab completion, validate on
save). Several common editor operations are missing that would elevate it from
a basic text editor into a proper low-code tool for Camel routes.
The key insight is that operations like move, duplicate, and delete should be
*YAML-structure-aware* -- operating on entire EIP/node blocks rather than
single lines. In YAML DSL, a single EIP step is often multiple lines:
{code:yaml}
steps:
- setHeader:
name: foo
simple: "${body}"
- to:
uri: kafka:myTopic
parameters:
brokers: localhost:9092
- log:
message: "Done"
{code}
Moving one line at a time is not useful here. What users need is to move the
entire {{- setHeader:}} block (all 3 lines) as a unit, swapping it with the
adjacent sibling {{- to:}} block (all 4 lines). Block boundaries can be
detected from the {{- }} list item prefix and indentation level.
The editor already has the YAML DSL model from the catalog for Tab completion,
so it has structural awareness to know where blocks start and end.
*Proposed features (ranked by user value):*
# *Undo / Redo* (Ctrl+Z / Ctrl+Shift+Z) -- needs an undo stack in TextAreaState
or SourceViewer
# *Move EIP block up/down* (Alt+Up / Alt+Down) -- swap entire sibling blocks,
not single lines
# *Duplicate EIP block* (Ctrl+D) -- duplicate the whole block, useful for
adding similar steps
# *Delete EIP block* (Ctrl+Shift+K) -- delete the entire block at once
# *Word-level navigation* (Ctrl+Left / Ctrl+Right / Ctrl+Backspace) -- jump and
delete by word
# *Smart Home* -- first press goes to first non-whitespace, second press to
column 0
# *Find in edit mode* (Ctrl+F) -- search exists in view mode but not while
editing
# *Comment toggle* (Ctrl+/) -- add/remove # prefix on current line
> camel-tui - YAML editor: undo/redo, block-aware move/duplicate/delete for EIP
> nodes
> -----------------------------------------------------------------------------------
>
> Key: CAMEL-24372
> URL: https://issues.apache.org/jira/browse/CAMEL-24372
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang
> Reporter: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> The TUI Source tab YAML editor currently supports basic character-level
> editing (insert, delete, cursor movement, auto-indent, Tab completion,
> validate on save). Several common editor operations are missing that would
> elevate it from a basic text editor into a proper low-code tool for Camel
> routes.
> The key insight is that operations like move, duplicate, and delete should be
> *YAML-structure-aware* -- operating on entire EIP/node blocks rather than
> single lines. In YAML DSL, a single EIP step is often multiple lines:
> {code:yaml}
> steps:
> - setHeader:
> name: foo
> simple: "${body}"
> - to:
> uri: kafka:myTopic
> parameters:
> brokers: localhost:9092
> - log:
> message: "Done"
> {code}
> Moving one line at a time is not useful here. What users need is to move the
> entire {{- setHeader:}} block (all 3 lines) as a unit, swapping it with the
> adjacent sibling {{- to:}} block (all 4 lines). Block boundaries can be
> detected from the {{- }} list item prefix and indentation level.
> The editor already has the YAML DSL model from the catalog for Tab
> completion, so it has structural awareness to know where blocks start and end.
> h3. YAML DSL editing (block-aware)
> # *Undo / Redo* (Ctrl+Z / Ctrl+Shift+Z) -- needs an undo stack in
> TextAreaState or SourceViewer
> # *Move EIP block up/down* (Alt+Up / Alt+Down) -- swap entire sibling blocks,
> not single lines
> # *Duplicate EIP block* (Ctrl+D) -- duplicate the whole block, useful for
> adding similar steps
> # *Delete EIP block* (Ctrl+Shift+K) -- delete the entire block at once
> # *Word-level navigation* (Ctrl+Left / Ctrl+Right / Ctrl+Backspace) -- jump
> and delete by word
> # *Smart Home* -- first press goes to first non-whitespace, second press to
> column 0
> # *Find in edit mode* (Ctrl+F) -- search exists in view mode but not while
> editing
> # *Comment toggle* (Ctrl+/) -- add/remove # prefix on current line or block
> h3. application.properties editing
> Properties files are line-oriented so standard line-level operations work
> fine here.
> # *Comment toggle* (Ctrl+/) -- the #1 operation in properties files. Comment
> out a property to disable it, uncomment to re-enable. Users do this
> constantly when experimenting with configuration.
> # *Value completion* -- Tab completion already works for property keys, but
> offering completions for values would be very useful: boolean (true/false),
> enum-typed options (e.g. {{camel.main.profile=}} offering dev/prod), duration
> format hints (10s, 5m, 1h), component schemes.
> # *Duplicate line* (Ctrl+D) -- handy when adding similar properties.
> # *Delete line* (Ctrl+Shift+K) -- quick removal of a property.
> # *Inline value validation* -- key validation exists on save, but validating
> values (wrong type, invalid enum, malformed duration) would catch mistakes
> earlier.
> Note: Undo/Redo and Comment toggle apply to both YAML and properties files.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)