|
|
@ -19,27 +19,21 @@ class SourceHighlighters extends ApiFactory { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO what to do with mod?
|
|
|
|
highlight (lineColumnPos, filePath, hexColor) { |
|
|
|
async highlight (mod, lineColumnPos, filePath, hexColor) { |
|
|
|
const { from } = this.currentRequest |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
try { |
|
|
|
let position |
|
|
|
const position = JSON.parse(lineColumnPos) |
|
|
|
try { |
|
|
|
if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter() |
|
|
|
position = JSON.parse(lineColumnPos) |
|
|
|
this.highlighters[from].currentSourceLocation(null) |
|
|
|
} catch (e) { |
|
|
|
this.highlighters[from].currentSourceLocationFromfileName(position, filePath, hexColor) |
|
|
|
throw e |
|
|
|
} catch (e) { |
|
|
|
} |
|
|
|
throw e |
|
|
|
if (!this.highlighters[mod]) this.highlighters[mod] = new SourceHighlighter() |
|
|
|
} |
|
|
|
this.highlighters[mod].currentSourceLocation(null) |
|
|
|
|
|
|
|
this.highlighters[mod].currentSourceLocationFromfileName(position, filePath, hexColor) |
|
|
|
|
|
|
|
resolve() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async discardHighlight (mod) { |
|
|
|
discardHighlight () { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
const { from } = this.currentRequest |
|
|
|
if (this.highlighters[mod]) this.highlighters[mod].currentSourceLocation(null) |
|
|
|
if (this.highlighters[from]) this.highlighters[from].currentSourceLocation(null) |
|
|
|
resolve() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|