Commit dd978686 authored by yann300's avatar yann300

fix highlight

parent 3d146aa3
...@@ -44,9 +44,7 @@ export const DebuggerApiMixin = (Base) => class extends Base { ...@@ -44,9 +44,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
} }
async highlight (lineColumnPos, path) { async highlight (lineColumnPos, path) {
await this.call('fileManager', 'open', path) await this.call('editor', 'highlight', lineColumnPos, path, '', { focus: true })
await this.call('editor', 'gotoLine', lineColumnPos.start.line, lineColumnPos.start.column)
await this.call('editor', 'highlight', lineColumnPos, path)
} }
async getFile (path) { async getFile (path) {
......
...@@ -141,7 +141,7 @@ class ContextualListener extends Plugin { ...@@ -141,7 +141,7 @@ class ContextualListener extends Plugin {
} }
const fileName = lastCompilationResult.getSourceName(position.file) const fileName = lastCompilationResult.getSourceName(position.file)
if (fileName) { if (fileName) {
return this.call('editor', 'highlight', lineColumn, fileName) return this.call('editor', 'highlight', lineColumn, fileName, '', { focus: false })
} }
} }
return null return null
......
...@@ -466,10 +466,12 @@ class Editor extends Plugin { ...@@ -466,10 +466,12 @@ class Editor extends Plugin {
await this.addDecoration(annotation, filePath, 'sourceAnnotationsPerFile') await this.addDecoration(annotation, filePath, 'sourceAnnotationsPerFile')
} }
async highlight (position, filePath) { async highlight (position, filePath, highlightColor, opt = { focus: true }) {
filePath = filePath || this.currentFile filePath = filePath || this.currentFile
if (opt.focus) {
await this.call('fileManager', 'open', filePath) await this.call('fileManager', 'open', filePath)
this.gotoLine(position.start.line, position.start.column) this.gotoLine(position.start.line, position.start.column)
}
await this.addDecoration({ position }, filePath, 'markerPerFile') await this.addDecoration({ position }, filePath, 'markerPerFile')
} }
......
...@@ -224,7 +224,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -224,7 +224,7 @@ module.exports = class TestTab extends ViewPlugin {
runningTests[fileName].content runningTests[fileName].content
) )
await this.call('editor', 'discardHighlight') await this.call('editor', 'discardHighlight')
await this.call('editor', 'highlight', location, fileName) await this.call('editor', 'highlight', location, fileName, '', { focus: true })
} }
} }
......
...@@ -27,9 +27,7 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => { ...@@ -27,9 +27,7 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => {
const handlePointToErrorOnClick = async (location, fileName) => { const handlePointToErrorOnClick = async (location, fileName) => {
await editor.call('editor', 'discardHighlight') await editor.call('editor', 'discardHighlight')
await editor.call('fileManager', 'open', fileName) await editor.call('editor', 'highlight', location, fileName, '', { focus: true })
await editor.call('editor', 'gotoLine', location.start.line, location.start.column)
await editor.call('editor', 'highlight', location, fileName)
} }
if (!message) return if (!message) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment