Conditonally wrap line in Monaco Editor

5.1k Views Asked by At

I want to be able to wrap a line conditionally.

if it matches a regex pattern then it doesn't wrap.

What is the best way to implement this?

1

There are 1 best solutions below

0
On

I believe you can call editor.updateOptions({ wordWrap: "off" }) to switch between the states after the editor has been created. Depending on your code you could call this function when your condition is true or false