import { TextDocumentContentChangeEvent , Range , Position } from 'vscode' ; function mutEditedLine ( editedLine ) { const newEditedLine = [ ] ; let startLine = 0 ; let before = 0 ; editedLine . reverse ( ) ; editedLine . forEach ( line => { startLine = line . range . start . line + before ; line . text . split ( /\n/ ) . map ( ( text , i , array ) => { if ( i === 0 && text === '' && array . length === 1 ) { startLine ++ ; } else { newEditedLine . push ( generateTextDocumentContentChange ( startLine ++ , text ) ) ; } before ++ ; } ) ; before -- ; } ) ; return newEditedLine ; } function generateTextDocumentContentChange ( line , text ) { return { rangeLength : 0 , rangeOffset : 0 , text : text , range : new Range ( new Position ( line , 0 ) , new Position ( line , text . length ) ) } ; } export { mutEditedLine } ;