21
21
import com .goide .dlv .protocol .DlvRequest ;
22
22
import com .goide .psi .*;
23
23
import com .goide .sdk .GoSdkService ;
24
- import com .intellij .debugger .impl .DebuggerUtilsEx ;
25
24
import com .intellij .execution .configurations .ModuleBasedConfiguration ;
26
25
import com .intellij .execution .configurations .RunProfile ;
27
26
import com .intellij .icons .AllIcons ;
37
36
import com .intellij .openapi .vfs .VirtualFile ;
38
37
import com .intellij .psi .PsiDocumentManager ;
39
38
import com .intellij .psi .PsiElement ;
39
+ import com .intellij .psi .PsiFile ;
40
40
import com .intellij .psi .util .PsiTreeUtil ;
41
41
import com .intellij .ui .ColoredTextContainer ;
42
42
import com .intellij .ui .SimpleTextAttributes ;
@@ -81,6 +81,11 @@ public void evaluate(@NotNull String expression,
81
81
.done (variable -> callback .evaluated (createXValue (variable , AllIcons .Debugger .Watch )))
82
82
.rejected (throwable -> callback .errorOccurred (throwable .getMessage ()));
83
83
}
84
+
85
+ @ Nullable
86
+ private PsiElement findElementAt (@ Nullable PsiFile file , int offset ) {
87
+ return file != null ? file .findElementAt (offset ) : null ;
88
+ }
84
89
85
90
@ Nullable
86
91
@ Override
@@ -91,8 +96,7 @@ public TextRange getExpressionRangeAtOffset(@NotNull Project project,
91
96
Ref <TextRange > currentRange = Ref .create (null );
92
97
PsiDocumentManager .getInstance (project ).commitAndRunReadAction (() -> {
93
98
try {
94
- PsiElement elementAtCursor =
95
- DebuggerUtilsEx .findElementAt (PsiDocumentManager .getInstance (project ).getPsiFile (document ), offset );
99
+ PsiElement elementAtCursor = findElementAt (PsiDocumentManager .getInstance (project ).getPsiFile (document ), offset );
96
100
GoTypeOwner e = PsiTreeUtil .getParentOfType (elementAtCursor ,
97
101
GoExpression .class ,
98
102
GoVarDefinition .class ,
0 commit comments