Carbon: Prettier to format code on demand

Created on 27 Jul 2018  路  4Comments  路  Source: carbon-app/carbon

Thanks for the great tool. I user Carbon regularly and am a super fan of prettier as well. It would be nice to be able to integrate them together.

I've been tweaking around with prettier codebase lately and also got a demo running for a prettier rest api server and also a static version of prettier standalone UMD packages.

I've been so excited about this that I started to add it to carbon locally :)

This is just a basic demo from what I've got so far:

carbon-prettier

Since prettier has a finite list of supported languages and technologies, I've been thinking about integrating dynamic parsers of prettier with the language that highlight.js detects from the editor.

Also prettier configurations might be good to be added to the settings dropdown menu.

I'd be happy to send a WIP PR if this looks good enough 馃憤

enhancement

Most helpful comment

Totally fair.

My use case on a daily basis is such I use carbon a lot! and non pretty indented code pasted in carbon editor bugs me sometimes. I used to use my local projects or code sandbox for prettifying the code sample, but having in inside the carbon sounds like an enormous win 馃憤

I'd be more than happy to help with the integration if you want this to happen sometimes in future :)

All 4 comments

@farskid this looks cool, however I'm not sure we want to start implementing all of these editor features within Carbon. Yes Prettier is pretty easy to maintain, but we are not trying to make Carbon into another CodeSandbox (@compuives has you covered there 馃檪) and could create a slippery slope.

Totally fair.

My use case on a daily basis is such I use carbon a lot! and non pretty indented code pasted in carbon editor bugs me sometimes. I used to use my local projects or code sandbox for prettifying the code sample, but having in inside the carbon sounds like an enormous win 馃憤

I'd be more than happy to help with the integration if you want this to happen sometimes in future :)

@farskid after talking some more with @mfix22, we think you make a good case for this. I'll defer to @jakedex as far as what the interface should look like, but go ahead and submit a WIP PR if you like 馃槂

@briandennis Super Cool! I'm on it. will send a WIP very soon. Thanks for the feature people :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itaditya picture itaditya  路  3Comments

shaonkabir8 picture shaonkabir8  路  5Comments

mxstbr picture mxstbr  路  6Comments

JoeCodesStuff picture JoeCodesStuff  路  5Comments

MelSumner picture MelSumner  路  5Comments