From 1aa49cc0032d666e17a9eae91549920a0e498e24 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 25 Sep 2017 16:46:53 +0200 Subject: [PATCH] make sure we hightlight the current file --- src/app.js | 7 +++++-- src/app/editor/contextualListener.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app.js b/src/app.js index 5c53a7631e..f87e9dd04c 100644 --- a/src/app.js +++ b/src/app.js @@ -395,8 +395,11 @@ function run () { return compiler.lastCompilationResult }, highlight: (position, node) => { - position = offsetToLineColumnConverter.offsetToLineColumn(position, position.file, compiler.lastCompilationResult) - return editor.addMarker(position, config.get('currentFile'), 'highlightcall') + if (compiler.lastCompilationResult && compiler.lastCompilationResult.source && compiler.lastCompilationResult.source.target === config.get('currentFile')) { + position = offsetToLineColumnConverter.offsetToLineColumn(position, position.file, compiler.lastCompilationResult) + return editor.addMarker(position, config.get('currentFile'), 'highlightcall') + } + return null }, stopHighlighting: (event) => { editor.removeMarker(event.eventId, event.fileTarget) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 77f39eb458..59bde1cff8 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -67,7 +67,9 @@ class ContextualListener { var node = calls[call] var position = self.sourceMappingDecoder.decode(node.src) var eventId = self._api.highlight(position, node) - self._events.push({ eventId, position, fileTarget: compilationResult.source.target }) + if (eventId) { + self._events.push({ eventId, position, fileTarget: compilationResult.source.target }) + } } } }