adamjimenez / shiftedit

ShiftEdit IDE
Other
82 stars 18 forks source link

Beautifier just not up to the job currently #314

Closed wsherliker closed 5 years ago

wsherliker commented 6 years ago

Hi,

I know I keep going on about this but the beautifier really does not work well. As an example take: { "id": "324234", "object": "customer", "account_balance": 0, "created": 1529393906, "currency": null, "default_source": "234", "delinquent": false, "description": "Customer", "discount": null, "email": null, "invoice_prefix": "9723076", "livemode": false, "metadata": {}, "shipping": null, "sources": { "object": "list", "data": [ { "id": "234234", "object": "card", "address_city": "Helsinki", "address_country": "Finland", "address_line1": "Address 1", "address_line1_check": "pass", "address_line2": "", "address_state": null, "address_zip": "11111", "address_zip_check": "pass", "brand": "Visa", "country": "US", "customer": "234234", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 1, "exp_year": 2020, "fingerprint": "234234", "funding": "credit", "last4": "4242", "metadata": {}, "name": "Warren Sherliker", "tokenization_method": null } ], "has_more": false, "total_count": 1, "url": "..." }, "subscriptions": { "object": "list", "data": [], "has_more": false, "total_count": 0, "url": "..." } }

Which when you run through jsbeautifier.org gives you (note Github remove the tabs but the are in the below and it looks like proper formatted JavaScript): { "id": "324234", "object": "customer", "account_balance": 0, "created": 1529393906, "currency": null, "default_source": "234", "delinquent": false, "description": "Customer", "discount": null, "email": null, "invoice_prefix": "9723076", "livemode": false, "metadata": {}, "shipping": null, "sources": { "object": "list", "data": [{ "id": "234234", "object": "card", "address_city": "Helsinki",...

But when you put through Shiftedit beautifier gives you (which also has tabs in it but looks very poor): { "id": "324234", "object": "customer", "account_balance": 0, "created": 1529393906, "currency": null, "default_source": "234", "delinquent": false, "description": "Customer", "discount": null, "email": null, "invoice_prefix": "9723076", "livemode": false, "metadata": {}, "shipping": null, "sources": { "object": "list", "data": [ { "id": "234234", "object": "card", "address_city": "Helsinki", "address_country": "Finland",...

This is really not very good... the old beautifier worked fine BTW as I keep saying. In fact that was why we first started using ShiftEdit as it had a decent beautifier built in. Now I have to keep using external services like jsbeautifier.org and it is a big pain.

Warren

wsherliker commented 6 years ago

Hi Adam,

Any progress on this - the beautifier does not work for JavaScript, HTML, XML etc. If you paste in data and click beautify it never never does the job you would expect. The old beautifier from ages back did.

I am not sure what the logic is in this new one but it does not work.

It is a real shame as I used the beautify feature loads, in fact it was why I chose ShiftEdit in the first place. Now I am continually going to other sites to beautify the code to paste back in to ShiftEdit which is to be honest a waste of time.

Please please look at this again and use some industry standard system. I have given examples in this ticket already but you can try some XML, HTML etc. Just remove any newlines, paste it into ShiftEdit and try the beautify, it does very little to the code. Then use some online beautifier and see the difference.

Cheers

Warren

wsherliker commented 6 years ago

Hi Adam, Still no update on this one? Sorry to hassle but it is a daily pain point. Warren

adamjimenez commented 6 years ago

Thanks for the example. I will work on that when I get a chance. It needs to be improved but I'm not sure why it would be a daily issue as files don't become messy over-night.

wsherliker commented 5 years ago

Hi Adam,

We make new code regularly and we use open source snippets. Given that when we add them to a JS file it is an issue. Similarly when we import HTML and XML the same applies. It really is a daily issue for us and I suspect most developers.

W

adamjimenez commented 5 years ago

I've pushed a fix to the dev branch which works better with your example. If there's any other cases like this please provide more sample code.