Is it possible to remove a code line by its number?


#1

Let’s say I’d like to remove lines that contain a particular code. I’m using the following code:

const cursor = editor.getSearchCursor('// #foldBlock');
while (cursor.findNext()) {
   const lineNumber = cursor.from().line;
   // how can I remove a line using the `lineNumber` value?
}

Thanks.


#2

Something like editor.replaceRange("", new Pos(line, 0), new Pos(line + 1, 0)) should do it.