closure-compiler icon indicating copy to clipboard operation
closure-compiler copied to clipboard

Is it possible to not add line breaks every 500 characters?

Open ghnp5 opened this issue 2 years ago • 4 comments

google/closure-compiler intentionally adds a line break after every 500 characters.

Is there a way to prevent this behavior, and not add these line breaks, or could this be added as an option, please?

ghnp5 avatar Aug 04 '23 00:08 ghnp5

It looks like there is a setter for this on CompilerOptions (if you have your own subclass of either CommandLineRunner or AbstractCommandLineRunner, or if you directly create your own Compiler instance), but this isn't presently exposed via command line flags.

https://github.com/google/closure-compiler/blob/ff2c49e5a0f0fedae10e2a01a3b8326aad1a0c0f/src/com/google/javascript/jscomp/CompilerOptions.java#L65-L66 https://github.com/google/closure-compiler/blob/ff2c49e5a0f0fedae10e2a01a3b8326aad1a0c0f/src/com/google/javascript/jscomp/CompilerOptions.java#L973 https://github.com/google/closure-compiler/blob/ff2c49e5a0f0fedae10e2a01a3b8326aad1a0c0f/src/com/google/javascript/jscomp/CompilerOptions.java#L2489-L2491

niloc132 avatar Aug 04 '23 02:08 niloc132

Yes, setting it to 0 will tell it not to break at all.

concavelenz avatar Aug 04 '23 20:08 concavelenz

Yes, setting it to 0 will tell it not to break at all.

How do I set it to 0? (I use the command line)

ghnp5 avatar Aug 04 '23 22:08 ghnp5

It seems we haven't exposed a command-line option for setting this value.

Here's the file where one would add that and an example option to copy.

https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/CommandLineRunner.java#L217

If you'd like to submit a PR, we'll be happy to review and merge it.

Or you could just change the constant value in your download of our sources and rebuild.

brad4d avatar Sep 01 '23 19:09 brad4d