Pretty print package?


#1

Has anyone looked in pretty printing yet? If not, can anyone suggest a module I could turn into a package?


Is there a package like beautify ruby package in sublime text 3?
#2

Short answer: yes :grinning:

Longer question that might lead to an answer: Pretty printing what?

So yeah, there are a few :smile: It just depends on what you’re trying to reformat.

P.S. I really wish we could come up with a standard term for this process … prettify, beautify, tidy, comb … geez :rage:


#3

“prettyprint”, “pretty print”, and “beautify” are all in common usage. I just find it hard to remember how to spell “beautify”. Wikipedia calls it prettyprint.

I was hoping there would be a beautify engine that supports many languages. If not then I could try making it easy to add disparate modules.

I just realized that beautify wouldn’t really be useful for coffeescript since you are forced into the one outline format. Coffeescript is about the only thing I use so I guess I’ll retract the original request. I’ve been looking for things to work on.

Sorry to bother everyone.


#4

Yea there are quite a few beautifiers already, this one having the most downloads so far: https://atom.io/packages/atom-beautify

Never be sorry for asking for ways to help!

Good point about coffeescript. I have only recently looked into it, because of atom mainly, and it’s kind of nice to see that beautification is practically compiler-enforced, isn’t it? Looking at Ruby and Python etc, it seems to be the future of coding…

Now, if only browsers were to support it natively so we didn’t have to compile it at all anymore…


#5

Indentation is only one aspect of beautifiers, really. There are all the myriad other preferences as well, such as for CoffeeScript:

  • Spaces around operators
  • Spaces around equals in default arguments
  • Spaces on the inside of braces
  • Whether to inline single-line functions, i.e. foo = (param) -> someOtherFunction(param)
  • Whether to allow unquoted keys for data-only objects
  • etc

#6

Doesn’t work for me. On the first file I tried it on, an SCSS file, if failed.