diff --git a/src/app/editor/SourceHighlighters.js b/src/app/editor/SourceHighlighters.js index 7560d2832b..7bd678148c 100644 --- a/src/app/editor/SourceHighlighters.js +++ b/src/app/editor/SourceHighlighters.js @@ -14,8 +14,15 @@ class SourceHighlighters { try { if (!this.highlighters[from]) this.highlighters[from] = [] const sourceHighlight = new SourceHighlighter() - sourceHighlight.currentSourceLocationFromfileName(position, filePath, hexColor) - this.highlighters[from].push(sourceHighlight) + if ( + !this.highlighters[from].length || + (this.highlighters[from].length && !this.highlighters[from].find((el) => { + return el.source === filePath && el.position === position + })) + ) { + sourceHighlight.currentSourceLocationFromfileName(position, filePath, hexColor) + this.highlighters[from].push(sourceHighlight) + } } catch (e) { throw e } diff --git a/src/app/tabs/staticanalysis/staticAnalysisView.js b/src/app/tabs/staticanalysis/staticAnalysisView.js index f861b93710..2723c73754 100644 --- a/src/app/tabs/staticanalysis/staticAnalysisView.js +++ b/src/app/tabs/staticanalysis/staticAnalysisView.js @@ -108,9 +108,9 @@ staticAnalysisView.prototype.run = function () { if (!this.view) { return } - const highlightLocation = (location, fileName) => { - // await this.analysisModule.call('editor', 'highlight', location, fileName) @todo(#2834) use this after fixing the issue - this.sourceHighlighter.currentSourceLocationFromfileName(location, fileName) + const highlightLocation = async (location, fileName) => { + await this.analysisModule.call('editor', 'discardHighlight') + await this.analysisModule.call('editor', 'highlight', location, fileName) } const selected = this.selectedModules() const warningContainer = $('#staticanalysisresult')