prettier make my short lines longer [duplicate] - prettier

This question already has answers here:
Is there a config in prettier to keep line breaks?
(4 answers)
Closed 9 months ago.
Is there any option in prettier that will disable that behavior when I have well-formatted by hands multi-line code that will fit in 80 characters and will be properly-formatted in one line but will looks ugly.
I want to keep it as is.

That's not possible, as Prettier will rewrite the whole thing. It's also going to be hard to recognise if it was the intended behaviour or not, as Prettier fixes other issues as well.

Related

One or more unexpected \r (^M) found;better to use only a \n [whitespace/newline] [1]? [duplicate]

This question already has answers here:
What flag silences GCC's warning about no newline at file-endings?
(6 answers)
Closed 2 years ago.
Whenever I am compiling my cpp file on LMS and in return Style error is coming with this sentence. One or more unexpected \r (^M) found;better to use only a \n [whitespace/newline] [1]??
Sounds like your compiler is complaining about CRLF-encoded files (DOS/Windows) instead of LF-only, as per UNIX/POSIX conventions.
You may need to adjust your editor to save in the correct format.

Why using (.|\n)*? is a bad idea? [duplicate]

This question already has answers here:
How do I match any character across multiple lines in a regular expression?
(26 answers)
Regex search with pattern containing (?:.|\s)*? takes increasingly long time
(1 answer)
Closed 3 years ago.
A few times I saw regex experts say that using (.|\n)*? is a really, really bad idea.
Well, I do understand that it's better to replace it with the .* and use the /s flag. But sometimes the flags are not available, for example, when using regex within a text editor or other software with limited regex functionality. Thus, using something like (.|\n)*? might be the only option for multi-line matching.
So, what are the reasons to always avoid (.|\n)*??

Redefining a #define in c++ on run time [duplicate]

This question already has answers here:
Changing a macro at runtime in C
(5 answers)
Closed 5 years ago.
Right now I'm merging two codes with the same core, but they differentiate with the #defines, what I need is to make a way around it an choose wicth configuration I need on run time, the code uses if ENABLE(defined) to verify the configurations to load, how can I modify the code to make it work?
Thanks
You can't. Macro are pre-processor. They are gone during compilation.
Variables are the best choice.
By the way, this question is answered here.
Changing a macro at runtime in C

Golang Regexp Reference within MustCompile (Find repeating character) [duplicate]

This question already has answers here:
Regex to match repeated characters
(3 answers)
Closed 6 years ago.
I am having a hard time with Go's regex. It seems it's different than other language, can someone help me on this.
Obj. I want MustCompile to find all repeated characters in the string.
APPLE (where P's repeating)
re := regexp.MustCompile("(\\w)\\${1}\\+")
Above is what I have tried but didn't work at all. Basically I wanted to do:
([A-Za-z])\1+
Can someone tell me what I am doing wrong?
Example below:
https://play.golang.org/p/DeuaIva968
Apparently Golang doesn't supposed back referencing due to efficiency. :(
Thank you everyone for your help.

How can I generate text from a RegEx? [duplicate]

This question already has answers here:
Using Regex to generate Strings rather than match them
(12 answers)
Reverse regular expression, create string from regex
(1 answer)
Closed 9 years ago.
Or "How can I RegEx in reverse?"
specifically I want to take a regex such as wks[0-9][0-9][0-9]
and create a list such as wks001,wks002,wks003, etc
I know the easiest way in this example would be to simply increment the number through addition, but say I want it to be even more sophisticated later on such as [0-9abc] I'd like to use a more sophisticated tool.
preferable would be some windows capable scripting tech, such as vbscript/powershell but I'm open to other alternatives. I guess I kind of thought this might be something that is done all the time by random number generators and such and would be a programming staple, but I lack the understanding to phrase it correctly I think.