GN.
GN.

Reputation: 9889

How to get Monaco Editor array of lines

How to get Monaco Editor array of lines? I'm going through the doc and see how to get the string value, but need to loop through each line and map the values.

Upvotes: 1

Views: 965

Answers (1)

Wagner Pereira
Wagner Pereira

Reputation: 1078

You can do something like this:

//  let editor1 = monaco.editor.create( ... 
let model = editor1.getModel();
for (let i = 0; i < model.getLineCount(); i++) {
    let line = model.getLineContent(i);
    // do something
}

Upvotes: 2

Related Questions