Disable hard wrap Follow Ghanashyam Sateesh Created December 22, 2019 14:40 How can I disable 'Hard wrap at'?
Do you mean wrapping that is performed on auto-formatting? What language is it about? Please share a code snippet where you'd like to disable hard wrapping
Yeah. I'm talking about JSX. So I had set the attribute Hard wrap at to zero thinking that hardwrap would be disabled. But then, this code:
Kept getting formatted to:
When I changed the Hard wrap at to 120 (Default), it stopped. Hence I was wondering how to disable hard wrapping... Thank You!
>So I had set the attribute Hard wrap at to zero thinking that hardwrap would be disabled.
it sets the right margin to 0, causing everything that is configured to be wrapped/chopped down when long to be always wrapped as it doesn't fit the specified page width (0)
Is your issue solved now, when the right margin is changed back to 120?
Yep... But also, I'm trying to disable hard wrapping all together... Any way I can do that?? I prefer soft wrapping...
there is no single place to disable it. Each language (even each particular statement type) has its own options for this.
Yep... So I did configure the whole thing for JS and disabled wrapping for all the features. But I could not find the setting for method definitions/arrow function definitions. I have already set Keep when reformatting > Simple methods in one line to true.
I actually still feel there should be a 'no' option for Hard wrap at field.
> But I could not find the setting for method definitions/arrow function definitions.
should be controlled by Method declaration parameters option; if it doesn't work for you, can you share code snippets?
Method declaration parameters only apply to the parameter list and not the method body evidently... The code snippets I've already shared above
Note that JSX tags are treated as 'inline' and thus aren't wrapped (https://youtrack.jetbrains.com/issue/WEB-37966) so hard wrapping is already disabled for them
I'm hitting the same issue with Django templates using .html extensions. The templating markup isn't as tolerant of hard wraps as HTML and this has caused me a ton of dev friction recognizing the hard wraps occurred, correcting (getting into a frustrating back and forth at times), not seeing wraps that cause soft errors locally that blow up once they reach a prod-like env, locate that hard-wrap induced error, slap head a few times to remember, fix and try again...
"Disable on typing" helped a smidge but, as Ghanashyam Sateesh noted, all of this configuration headache and dev friction could be avoided if we could simply disable this feature for certain file types.
FWIW, I have "Hard wrap at" set to the max of 1000 columns which seems to work until I, say, update the viewbox of an uglified SVG. Still some edge cases, lol