camel-tooling/camel-idea-plugin

`doTry...doCatch` formatting with `unmarshall(new JacksonDataFormat(...))`

joao-martins-tdx opened this issue · 4 comments

When I format the following code with camel-idea-plugin 1.1.3:

    .doTry()
        .unmarshal(new JacksonDataFormat(objectMapper, Foo.class))
    .doCatch(JsonProcessingException.class)
        .to("direct:deserialization-error-handler")
    .end()

I get the following result:

    .doTry()
        .unmarshal(new
        JacksonDataFormat(mapper, Object.class)).doCatch(JsonProcessingException.class)
    .to("direct:deserialization-error-handler").end();

Is this the expected behaviour?

I understand that code style is a subjective topic, however, the original indentation seems to better reflect the structure of doTry...doCatch than the one produced by camel-idea-plugin.

Yes the original is correct. The formatter needs special code to handle all those special EIPs so its requires some code changes in the plugin. You are welcome to help if you can.

@essobedo have to step away from Camel for a while and we dont have as much time and resources to work on this plugin. Its 100% community and spare-time.

If it can wait, I can check that next week or the following, otherwise feel free to propose a PR

otherwise feel free to propose a PR

Thanks for the prompt reply @essobedo @davsclaus!

It can wait. I may be able to help, but essobedo is probably the best person to do it, so I'll wait for the fix :)