Code-reformat to indent routes in RouteBuilders
See original GitHub issueConfigure IDEA’s code reformat feature (standard keybind: Ctrl + Alt + L) to correctly indent things like choices to reflect their functionality, like code-blocks are formatted in standard Java.
An example in a RouteBuilder
This is how IDEA wants to indent this code:
from("direct:getBgUser")
.process(buildBGAuthRequest)
.to("direct:bgmock")
.choice()
.when(credentialsValid)
.process(createNumbersResponseFromBGResponse)
.otherwise()
.setHeader(Exchange.HTTP_RESPONSE_CODE).constant(401)
.end()
;
And this is how IDEA should indent it:
from("direct:getBgUser")
.process(buildBGAuthRequest)
.to("direct:bgmock")
.choice()
.when(credentialsValid)
.process(createNumbersResponseFromBGResponse)
.otherwise()
.setHeader(Exchange.HTTP_RESPONSE_CODE).constant(401)
.end()
;
How the correct indentation is done in this example is purely my opinion and should be worked on further. But making it configurable would be the best way to avoid anyone calling it out as “wrong”.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:88
- Comments:17
Top Results From Across the Web
Completely unusable and annoying auto format in any camel ...
This is a camel route written in java DSL ... If you do not want Intellij IDEA automatically indent code on paste (regardless...
Read more >How to indent/format a selection of code in Visual Studio Code?
Select the lines you want to indent, and; use Ctrl + ] to indent them. If you want to format a section (instead...
Read more >RouteBuilder - Apache Camel
The RouteBuilder is a base class which is derived from to create routing rules using the DSL. Instances of RouteBuilder are then added...
Read more >Code Reformat Finished - OpenSSL Blog
The '-v' argument provides verbose output, and '-c' applies comment formatting rules. The next problem was that we wanted indent to reformat our ......
Read more >Basic Editing in Visual Studio Code
Indentation. VS Code lets you control text indentation and whether you'd like to use spaces or tab stops. By default, VS Code inserts...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@haraldfw I tried it three times, but didn’t get it up and running yet. I also would like to have this feature as soon as possible because of your reasons. Unfortunately it’s not that straightforward 😦
You can manually turn code formatting off as shown here https://twitter.com/JavaGuyUA/status/969963553817092096