I have been working through using the browser based version of the Microsoft Monaco Editor, I can\'t find any documentation or any examples in the playground that tell you how t
I think there is no such built-in feature in monaco as I do not found it. but i am doing that using following code:
editor.addAction({
id: 'some_id',
label: 'label',
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_C],
run: function(ed) {
var position = ed.getPosition();
var text = ed.getValue(position);
var splitedText=text.split("\n");
var line = splitedText[position.lineNumber-1];
// now you have current line
// you can also get any other line
// and do something with that line
splitedText[position.lineNumber-1]= _newLineText_
ed.setValue(splitedText.join("\n"));
ed.setPosition(position); // to return the pointer to the a position before editing text
return null;
},
enablement: {
textFocus: true,
}
});
this method is good for small file but for large file the whole editor will re highlights and that a bad thing.