|
|
@ -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) => { |
|
|
|
|
|
|
|
let position |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
position = JSON.parse(lineColumnPos) |
|
|
|
const position = JSON.parse(lineColumnPos) |
|
|
|
|
|
|
|
if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter() |
|
|
|
|
|
|
|
this.highlighters[from].currentSourceLocation(null) |
|
|
|
|
|
|
|
this.highlighters[from].currentSourceLocationFromfileName(position, filePath, hexColor) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
throw 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() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|