"Intelligent" word wrapping on Visual Studio Code

Viewed 1129

I was quite annoyed of having to scroll horizontaly on VScode, so I set the following settings to enable word-wrapping:

"editor.wordWrap": "on",
"editor.wrappingIndent": "indent"

However, I find it quite anoying that it wraps in places where I wouldn't want, for example, for a function call like this one:

myLongNameFunc(longNameVarA, longNameVarB);

It is wrapping it like this, splitting it on the semicolon:

myLongNameFunc(longNameVarA, longNameVarB)
    ;

And I would rather see something like this:

myLongNameFunc(longNameVarA, 
    longNameVarB);

Is it possible to set this configuration in some way? Allowing it to wrap on spaces if possible, for instance?

Thanks,

1 Answers

It's been some time... but I see v1.42 will have a new wrapping strategy option which fixes your example for me:

Editor: Wrapping Strategy

choose advanced

Controls the algorithm that computes wrapping points.

  • simple: Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width.

  • advanced: Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.

As the setting warns, advanced could adversely affect large files but it does properly wrap your example.

Related