|
|
|
@ -1,9 +1,6 @@ |
|
|
|
|
'use strict' |
|
|
|
|
const SourceHighlighter = require('./sourceHighlighter') |
|
|
|
|
|
|
|
|
|
// EditorApi:
|
|
|
|
|
// - methods: ['highlight', 'discardHighlight'],
|
|
|
|
|
|
|
|
|
|
class SourceHighlighters { |
|
|
|
|
|
|
|
|
|
constructor () { |
|
|
|
@ -28,6 +25,24 @@ class SourceHighlighters { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
highlightAllFrom (from) { |
|
|
|
|
try { |
|
|
|
|
if (!this.highlighters[from]) return |
|
|
|
|
const sourceHighlight = new SourceHighlighter() |
|
|
|
|
for (const index in this.highlighters[from]) { |
|
|
|
|
sourceHighlight.currentSourceLocationFromfileName( |
|
|
|
|
this.highlighters[from][index].position, |
|
|
|
|
this.highlighters[from][index].filePath, |
|
|
|
|
this.highlighters[from][index].hexColor |
|
|
|
|
) |
|
|
|
|
this.highlighters[from][index] = sourceHighlight |
|
|
|
|
} |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
discardHighlight (from) { |
|
|
|
|
if (this.highlighters[from]) { |
|
|
|
|
for (const index in this.highlighters[from]) this.highlighters[from][index].currentSourceLocation(null) |
|
|
|
@ -35,6 +50,15 @@ class SourceHighlighters { |
|
|
|
|
this.highlighters[from] = [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hideHighlightsExcept (toStay) { |
|
|
|
|
for (const highlighter in this.highlighters) { |
|
|
|
|
for (const index in this.highlighters[highlighter]) { |
|
|
|
|
this.highlighters[highlighter][index].currentSourceLocation(null) |
|
|
|
|
} |
|
|
|
|
this.highlightAllFrom(toStay) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
discardHighlightAt (line, filePath, from) { |
|
|
|
|
if (this.highlighters[from]) { |
|
|
|
|
for (const index in this.highlighters[from]) { |
|
|
|
|