use SourceHighlighters plugin in StaticAnalisys and remove multiple

highligh for same position
pull/5370/head
LianaHus 5 years ago
parent bb0ca07f99
commit a0371f21d9
  1. 7
      src/app/editor/SourceHighlighters.js
  2. 6
      src/app/tabs/staticanalysis/staticAnalysisView.js

@ -14,8 +14,15 @@ class SourceHighlighters {
try { try {
if (!this.highlighters[from]) this.highlighters[from] = [] if (!this.highlighters[from]) this.highlighters[from] = []
const sourceHighlight = new SourceHighlighter() const sourceHighlight = new SourceHighlighter()
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) sourceHighlight.currentSourceLocationFromfileName(position, filePath, hexColor)
this.highlighters[from].push(sourceHighlight) this.highlighters[from].push(sourceHighlight)
}
} catch (e) { } catch (e) {
throw e throw e
} }

@ -108,9 +108,9 @@ staticAnalysisView.prototype.run = function () {
if (!this.view) { if (!this.view) {
return return
} }
const highlightLocation = (location, fileName) => { const highlightLocation = async (location, fileName) => {
// await this.analysisModule.call('editor', 'highlight', location, fileName) @todo(#2834) use this after fixing the issue await this.analysisModule.call('editor', 'discardHighlight')
this.sourceHighlighter.currentSourceLocationFromfileName(location, fileName) await this.analysisModule.call('editor', 'highlight', location, fileName)
} }
const selected = this.selectedModules() const selected = this.selectedModules()
const warningContainer = $('#staticanalysisresult') const warningContainer = $('#staticanalysisresult')

Loading…
Cancel
Save