diff --git a/apps/debugger/src/app/debugger-api.ts b/apps/debugger/src/app/debugger-api.ts index 1fa089b5d2..6727988c9a 100644 --- a/apps/debugger/src/app/debugger-api.ts +++ b/apps/debugger/src/app/debugger-api.ts @@ -44,9 +44,7 @@ export const DebuggerApiMixin = (Base) => class extends Base { } async highlight (lineColumnPos, path) { - await this.call('fileManager', 'open', path) - await this.call('editor', 'gotoLine', lineColumnPos.start.line, lineColumnPos.start.column) - await this.call('editor', 'highlight', lineColumnPos, path) + await this.call('editor', 'highlight', lineColumnPos, path, '', { focus: true }) } async getFile (path) { diff --git a/apps/remix-ide/src/app/editor/contextualListener.js b/apps/remix-ide/src/app/editor/contextualListener.js index 883f1d0124..9eea6aeaed 100644 --- a/apps/remix-ide/src/app/editor/contextualListener.js +++ b/apps/remix-ide/src/app/editor/contextualListener.js @@ -141,7 +141,7 @@ class ContextualListener extends Plugin { } const fileName = lastCompilationResult.getSourceName(position.file) if (fileName) { - return this.call('editor', 'highlight', lineColumn, fileName) + return this.call('editor', 'highlight', lineColumn, fileName, '', { focus: false }) } } return null diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index b2d488a17d..128f5b0c83 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -466,10 +466,12 @@ class Editor extends Plugin { await this.addDecoration(annotation, filePath, 'sourceAnnotationsPerFile') } - async highlight (position, filePath) { + async highlight (position, filePath, highlightColor, opt = { focus: true }) { filePath = filePath || this.currentFile - await this.call('fileManager', 'open', filePath) - this.gotoLine(position.start.line, position.start.column) + if (opt.focus) { + await this.call('fileManager', 'open', filePath) + this.gotoLine(position.start.line, position.start.column) + } await this.addDecoration({ position }, filePath, 'markerPerFile') } diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index df001652ba..9dd245fbb3 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -224,7 +224,7 @@ module.exports = class TestTab extends ViewPlugin { runningTests[fileName].content ) await this.call('editor', 'discardHighlight') - await this.call('editor', 'highlight', location, fileName) + await this.call('editor', 'highlight', location, fileName, '', { focus: true }) } } diff --git a/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx b/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx index 6e99337800..b8c04330d7 100644 --- a/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx +++ b/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx @@ -27,9 +27,7 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => { const handlePointToErrorOnClick = async (location, fileName) => { await editor.call('editor', 'discardHighlight') - await editor.call('fileManager', 'open', fileName) - await editor.call('editor', 'gotoLine', location.start.line, location.start.column) - await editor.call('editor', 'highlight', location, fileName) + await editor.call('editor', 'highlight', location, fileName, '', { focus: true }) } if (!message) return