[clang] [clang-format] Stop breaking unbreakable strings in JS (PR #66168)

via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 5 20:50:30 PST 2023


sstwcw wrote:

> Here are string literal context from closure - This still misses contexts when string literal is required, for example https://github.com/search?q=repo%3Agoogle%2Fclosure-compiler%20%22%20must%20be%20a%20string%20literal%22&type=code
> 
> I wonder, if splitting the literal with `+` is a good option at all.

I was trying to stop the formatter from breaking the arguments to certain functions by marking the lines as not breakable.  Then I found the commit 53c38f4e79ae which says that lines containing `goog.module` should not be broken but lines containing `goog.module.get` should be broken.  Who knows the rationale behind it?  Among the functions whose arguments must be a string literal, which ones make the entire line unbreakable?

https://github.com/llvm/llvm-project/pull/66168


More information about the cfe-commits mailing list