runInTestsCompilation
LianaHus 4 years ago committed by Liana Husikyan
parent d48c3dd548
commit a16d791988
  1. 2
      apps/remix-ide/src/app/tabs/test-tab.js
  2. 10
      apps/remix-ide/src/lib/offsetToLineColumnConverter.js

@ -141,10 +141,8 @@ module.exports = class TestTab extends ViewPlugin {
location = this.offsetToLineColumnConverter.offsetToLineColumnWithContent( location = this.offsetToLineColumnConverter.offsetToLineColumnWithContent(
location, location,
parseInt(file), parseInt(file),
runningTests,
runningTests[fileName].content runningTests[fileName].content
) )
this.fileManager.open(fileName)
await this.call('editor', 'discardHighlight') await this.call('editor', 'discardHighlight')
await this.call('editor', 'highlight', location, fileName) await this.call('editor', 'highlight', location, fileName)
} }

@ -36,14 +36,8 @@ export class OffsetToLineColumnConverter extends Plugin {
return this.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, this.lineBreakPositionsByContent[file]) return this.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, this.lineBreakPositionsByContent[file])
} }
offsetToLineColumnWithContent (rawLocation, file, sources, content) { offsetToLineColumnWithContent (rawLocation, file, content) {
const sourcesArray = Object.keys(sources) this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(content)
if (content === '' || (file === 0 && sourcesArray.length === 1)) {
// if we don't have ast, we process the only one available content (applicable also for compiler older than 0.4.12)
this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[sourcesArray[0]].content)
} else {
this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(content)
}
return this.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, this.lineBreakPositionsByContent[file]) return this.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, this.lineBreakPositionsByContent[file])
} }

Loading…
Cancel
Save