Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set EOL to LF for windows so that API gets value with \n. not \r\n

I've used monaco.editor.create method for creating model. The problem is monaco is parsing multiline codes into \r\n format in windows OS.

I've tried using defaultEOL as 'LF' in editorOptions in monaco.editor.create()

    let editorOptions = {
      value,
      quickSuggestions: { other: true, comments: true, strings: true },
      language: language,
      tabSize: tabSize,

      ...options
    };
    this._editor = monaco.editor.create(this._node, editorOptions);

I expect monaco editor to request my API with value \n

like image 815
SBimochan Avatar asked Nov 07 '22 16:11

SBimochan


1 Answers

I use the following:

let textModel = monaco.editor.createModel("");
textModel.setEOL(0);

Documentation:

monaco.editor.createModel

ITextModel.setEOL

like image 62
Matthew Steven Monkan Avatar answered Nov 30 '22 01:11

Matthew Steven Monkan