@@ -25,12 +25,11 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor
2525import com.intellij.openapi.project.Project
2626import com.intellij.xdebugger.XDebuggerUtil
2727import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter
28- import spp.jetbrains.marker.SourceMarker
29- import spp.protocol.artifact.exception.qualifiedClassName
28+ import spp.jetbrains.marker.impl.ArtifactNamingService
3029import spp.protocol.artifact.exception.sourceAsLineNumber
3130
3231/* *
33- * todo: probably don't need this as the breakpoint bar serves as the execution point indicator
32+ * Shows the execution point in the editor for the selected stack frame.
3433 *
3534 * @since 0.3.0
3635 * @author [Brandon Fergerson](mailto:bfergerson@apache.org)
@@ -47,18 +46,15 @@ class ExecutionPointManager(
4746
4847 override fun onChanged (stackFrameManager : StackFrameManager ) {
4948 if (! showExecutionPoint) return
50- val currentFrame = stackFrameManager.currentFrame
51- var fromClass = currentFrame!! .qualifiedClassName()
52-
53- // check for inner class
54- val indexOfDollarSign = fromClass.indexOf(" $" )
55- if (indexOfDollarSign >= 0 ) {
56- fromClass = fromClass.substring(0 , indexOfDollarSign)
57- }
58- val fileMarker = SourceMarker .getInstance(project).getSourceFileMarker(fromClass) ? : return
59- val virtualFile = fileMarker.psiFile.containingFile.virtualFile ? : return
49+ val currentFrame = stackFrameManager.currentFrame ? : return
50+ val psiFile = stackFrameManager.stackTrace.language?.let {
51+ ArtifactNamingService .getService(it).findPsiFile(it, project, currentFrame)
52+ } ? : return
53+ val virtualFile = psiFile.containingFile.virtualFile ? : return
6054 val document = FileDocumentManager .getInstance().getDocument(virtualFile) ? : return
61- val lineStartOffset = document.getLineStartOffset(currentFrame.sourceAsLineNumber()!! ) - 1
55+ val lineStartOffset = currentFrame.sourceAsLineNumber()?.let {
56+ document.getLineStartOffset(it) - 1
57+ } ? : return
6258
6359 ApplicationManager .getApplication().invokeLater {
6460 try {
@@ -69,7 +65,7 @@ class ExecutionPointManager(
6965 executionPointHighlighter.show(
7066 XDebuggerUtil .getInstance().createPositionByOffset(
7167 virtualFile, lineStartOffset
72- )!! , false , null
68+ )!! , true , null
7369 )
7470 } catch (e: Throwable ) {
7571 log.error(" Failed to set execution point" , e)
0 commit comments