Json-Eclipse-Plugin icon indicating copy to clipboard operation
Json-Eclipse-Plugin copied to clipboard

[Feature Request] Context aware settings?

Open Speiger opened this issue 3 years ago • 2 comments

o/ I know this project is like basically dead or just on life support, but if you want to improve it here would be a nice suggestion.

Context aware settings where you can set formatter rules based on the current context. To define the context I mean what JsonElementType you are right now in. Optionally also what the previous context you are in.

I know you can set formatter options right now but these usually lead to pretty bad json writing experience. What I wish that I could do is set rules when a element should be newly lined and when not. To give you a example of how I like my json to look like is this: image https://github.com/Speiger/PrettyGsonWriter

I know that this isn't easily achievable and is a huge ask, so please don't take it as a "MUST HAVE". If I had experience in Eclipse Plugin writing I maybe would do it on my own, but right now I rather give input on existing established plugins.

Anyhow thank you for reading my Request even if it stays unfulfilled. :)

P.s: Yes the image is intentionally taken that way.

Speiger avatar Jun 20 '22 08:06 Speiger

Thanks for the input and the effort. I had a short look at PrettyGsonWriter and couldn't full understand all the rules behind the code. But roughly speaking: you propose to format the content different depending on .. a) length/size of the object b) size of array elements to justify a new-line char of not. Is that correct?

msteiger avatar Jun 26 '22 15:06 msteiger

I suggest a format based on which element you are in and what element you are.

So Format Configs for: Object -> Object Object -> List Object -> element List -> Object List -> List List -> element

Because it would be nice if you could configure lists and maps differently.

What PrettyJsonFormatter does is a bit more excessive and can be done manually but it would be nice if yours was a bit more configureable in that regard.

Speiger avatar Jun 26 '22 16:06 Speiger