import { Position } from 'vscode-languageserver' ; import { SourceMapConsumer } from 'source-map' ; import { SourceMapDocumentMapper } from '../../lib/documents' ; export class ConsumerDocumentMapper extends SourceMapDocumentMapper { constructor ( consumer , sourceUri , private nrPrependesLines ) { super ( consumer , sourceUri ) ; } getOriginalPosition ( generatedPosition ) { return super . getOriginalPosition ( Position . create ( generatedPosition . line - this . nrPrependesLines , generatedPosition . character ) ) ; } getGeneratedPosition ( originalPosition ) { const result = super . getGeneratedPosition ( originalPosition ) ; result . line += this . nrPrependesLines ; return result ; } isInGenerated ( ) { return true ; } }