Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghnp5 opened this issue Aug 4, 2023 · 4 comments
Open

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

ghnp5 opened this issue Aug 4, 2023 · 4 comments

Comments

@ghnp5
Copy link

ghnp5 commented Aug 4, 2023

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?

@niloc132
Copy link
Contributor

niloc132 commented Aug 4, 2023

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.

// The number of characters after which we insert a line break in the code
static final int DEFAULT_LINE_LENGTH_THRESHOLD = 500;

int lineLengthThreshold = DEFAULT_LINE_LENGTH_THRESHOLD;

public void setLineLengthThreshold(int lineLengthThreshold) {
this.lineLengthThreshold = lineLengthThreshold;
}

@concavelenz
Copy link
Contributor

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

@ghnp5
Copy link
Author

ghnp5 commented Aug 4, 2023

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)

@brad4d
Copy link
Contributor

brad4d commented Sep 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants