robotcode
robotcode copied to clipboard
[ENHANCEMENT] Add onEnter rule to split a long line
Is your enhancement request related to a problem? Please describe.
Long lines can be split in several lines, each of which must start with an ellipsis (...
). Manually aligning the lines to the current indentation level and inserting the ellipsis is a waste of time.
Describe the solution you'd like
Add an onEnter Rule in the language-configuration.json
file.
"onEnterRules": [
{
"beforeText": "^\\s*\\.\\.\\.",
"action": { "indent": "none", "appendText": "... " }
}
]
Describe alternatives you've considered
None easier than this proposal.
Additional context
Use cases for this rule:
*** Settings ***
Library Browser
*** Variables ***
&{dict} first=John
... last=Smith
... street=Sesame St.
... phone=12345
*** Keywords ***
My Keyword
[Documentation] Super long documentation
... that helps the user
[Arguments] ${first super long argument}
... ${second super long argument}
... ${third super long argument}
Evaluate JavaScript
... function f() {
... return 3;
... }
You can also use robotframework-tidy ;-) Just install it and use "Format Document" . This also works for RobotFramework > 5
But I will look at this. And there is also a Language Server Feature named Document on Type Formatting Request, that maybe helps to implement this.
robotidy is not a solution. You still have to type the three dots plus two spaces afterwards and robotidy will align the lines. I did not know about that LSP feature. Maybe it can be implemented like that. I just thought that an onEnter rule gets the job done with least effort ;)