2121import com .goide .dlv .protocol .DlvRequest ;
2222import com .goide .psi .*;
2323import com .goide .sdk .GoSdkService ;
24- import com .intellij .debugger .impl .DebuggerUtilsEx ;
2524import com .intellij .execution .configurations .ModuleBasedConfiguration ;
2625import com .intellij .execution .configurations .RunProfile ;
2726import com .intellij .icons .AllIcons ;
3736import com .intellij .openapi .vfs .VirtualFile ;
3837import com .intellij .psi .PsiDocumentManager ;
3938import com .intellij .psi .PsiElement ;
39+ import com .intellij .psi .PsiFile ;
4040import com .intellij .psi .util .PsiTreeUtil ;
4141import com .intellij .ui .ColoredTextContainer ;
4242import com .intellij .ui .SimpleTextAttributes ;
@@ -81,6 +81,11 @@ public void evaluate(@NotNull String expression,
8181 .done (variable -> callback .evaluated (createXValue (variable , AllIcons .Debugger .Watch )))
8282 .rejected (throwable -> callback .errorOccurred (throwable .getMessage ()));
8383 }
84+
85+ @ Nullable
86+ private PsiElement findElementAt (@ Nullable PsiFile file , int offset ) {
87+ return file != null ? file .findElementAt (offset ) : null ;
88+ }
8489
8590 @ Nullable
8691 @ Override
@@ -91,8 +96,7 @@ public TextRange getExpressionRangeAtOffset(@NotNull Project project,
9196 Ref <TextRange > currentRange = Ref .create (null );
9297 PsiDocumentManager .getInstance (project ).commitAndRunReadAction (() -> {
9398 try {
94- PsiElement elementAtCursor =
95- DebuggerUtilsEx .findElementAt (PsiDocumentManager .getInstance (project ).getPsiFile (document ), offset );
99+ PsiElement elementAtCursor = findElementAt (PsiDocumentManager .getInstance (project ).getPsiFile (document ), offset );
96100 GoTypeOwner e = PsiTreeUtil .getParentOfType (elementAtCursor ,
97101 GoExpression .class ,
98102 GoVarDefinition .class ,
0 commit comments