|
|
|
@ -12,16 +12,33 @@ class SourceHighlighters { |
|
|
|
|
|
|
|
|
|
highlight (position, filePath, hexColor, from) { |
|
|
|
|
try { |
|
|
|
|
if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter() |
|
|
|
|
this.highlighters[from].currentSourceLocation(null) |
|
|
|
|
this.highlighters[from].currentSourceLocationFromfileName(position, filePath, hexColor) |
|
|
|
|
if (!this.highlighters[from]) this.highlighters[from] = [] |
|
|
|
|
const sourceHighlight = new SourceHighlighter() |
|
|
|
|
sourceHighlight.currentSourceLocationFromfileName(position, filePath, hexColor) |
|
|
|
|
this.highlighters[from].push(sourceHighlight) |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
discardHighlight (from) { |
|
|
|
|
if (this.highlighters[from]) this.highlighters[from].currentSourceLocation(null) |
|
|
|
|
if (this.highlighters[from]) { |
|
|
|
|
for (const index in this.highlighters[from]) this.highlighters[from][index].currentSourceLocation(null) |
|
|
|
|
} |
|
|
|
|
this.highlighters[from] = [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
discardHighlightAt (line, filePath, from) { |
|
|
|
|
if (this.highlighters[from]) { |
|
|
|
|
for (const index in this.highlighters[from]) { |
|
|
|
|
const highlight = this.highlighters[from][index] |
|
|
|
|
if (highlight.source === filePath && |
|
|
|
|
(highlight.position.start.line === line || highlight.position.end.line === line)) { |
|
|
|
|
highlight.currentSourceLocation(null) |
|
|
|
|
this.highlighters[from].splice(index, 1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|