Commit 15b9b619 authored by LianaHus's avatar LianaHus Committed by Liana Husikyan

added convertline with content

parent 12aa333e
...@@ -154,7 +154,8 @@ staticAnalysisView.prototype.run = function () { ...@@ -154,7 +154,8 @@ staticAnalysisView.prototype.run = function () {
start: parseInt(split[0]), start: parseInt(split[0]),
length: parseInt(split[1]) length: parseInt(split[1])
} }
location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location, location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(
location,
parseInt(file), parseInt(file),
self.lastCompilationSource.sources, self.lastCompilationSource.sources,
self.lastCompilationResult.sources self.lastCompilationResult.sources
......
...@@ -138,10 +138,11 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -138,10 +138,11 @@ module.exports = class TestTab extends ViewPlugin {
start: parseInt(split[0]), start: parseInt(split[0]),
length: parseInt(split[1]) length: parseInt(split[1])
} }
location = this.offsetToLineColumnConverter.offsetToLineColumn( location = this.offsetToLineColumnConverter.offsetToLineColumnWithContent(
location, location,
parseInt(file), parseInt(file),
runningTests runningTests,
runningTests[fileName].content
) )
await this.call('editor', 'discardHighlight') await this.call('editor', 'discardHighlight')
await this.call('editor', 'highlight', location, fileName) await this.call('editor', 'highlight', location, fileName)
...@@ -197,7 +198,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -197,7 +198,7 @@ module.exports = class TestTab extends ViewPlugin {
<div <div
class="bg-light mb-2 ${css.testFailure} ${css.testLog} d-flex flex-column text-danger border-0" class="bg-light mb-2 ${css.testFailure} ${css.testLog} d-flex flex-column text-danger border-0"
id="UTContext${result.context}" id="UTContext${result.context}"
onclick=${() => this.highlightLocation(result.location, runningTests, result.filename)} onclick=${() => this.highlightLocation(result.location, runningTests, result.filename)}
> >
<span> ✘ ${result.value}</span> <span> ✘ ${result.value}</span>
<span class="text-dark">Error Message:</span> <span class="text-dark">Error Message:</span>
......
...@@ -36,6 +36,19 @@ export class OffsetToLineColumnConverter extends Plugin { ...@@ -36,6 +36,19 @@ 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) {
if (!this.lineBreakPositionsByContent[file]) {
const sourcesArray = Object.keys(sources)
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])
}
clear () { clear () {
this.lineBreakPositionsByContent = {} this.lineBreakPositionsByContent = {}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment