Closed viliam-durina closed 6 months ago
IntelliJ already has that.
Alt+enter :
I was googling for it and couldn't find it... But IMO it's broken, it adds newlines if the concatenation is broken into multiple lines, but this is already reported and it's disputed, whether it's a bug or feature.
Sometimes you have a text in a Java String literal, which you want to copy-paste somewhere else, as if the text was printed. For example, you have the following Java String literal:
You want to convert it to:
We often have very long queries or pieces of HTML in String literals. Conversion in both ways would be useful, I don't know of another way how to do it automatically.
Unwrapping should fail if there's anything else other than a single
+
character and whitespace between individual string literals. Escaped characters should be unescaped.The usefulness will be slightly reduced after Java 15 which introduced multi-line string literals, I suppose IntelliJ has a conversion to this literal type, but many projects are stuck with older versions (mine are too).
Perhaps the current Quote/unquote feature can be replaced with this behavior, it's pretty useless IMO, it doesn't even escape/unescape the characters within the text.
The conversion might be useful for other languages too, but it should not be determined by the file type in the editor - most often I copy SQL queries to SQL console where I want to unwrap.