mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show debugger value hints when the documents are committed (EA-88577 - assert: PsiDocumentManagerBase.commitAllDocuments)
This commit is contained in:
+12
-15
@@ -20,7 +20,6 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.SelectionModel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.evaluation.ExpressionInfo;
|
||||
@@ -58,22 +57,20 @@ public class XQuickEvaluateHandler extends QuickEvaluateHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
return PsiDocumentManager.getInstance(project).commitAndRunReadAction(() -> {
|
||||
int offset = AbstractValueHint.calculateOffset(editor, point);
|
||||
ExpressionInfo expressionInfo = getExpressionInfo(evaluator, project, type, editor, offset);
|
||||
if (expressionInfo == null) {
|
||||
return null;
|
||||
}
|
||||
int offset = AbstractValueHint.calculateOffset(editor, point);
|
||||
ExpressionInfo expressionInfo = getExpressionInfo(evaluator, project, type, editor, offset);
|
||||
if (expressionInfo == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int textLength = editor.getDocument().getTextLength();
|
||||
TextRange range = expressionInfo.getTextRange();
|
||||
if (range.getStartOffset() > range.getEndOffset() || range.getStartOffset() < 0 || range.getEndOffset() > textLength) {
|
||||
LOG.error("invalid range: " + range + ", text length = " + textLength + ", evaluator: " + evaluator);
|
||||
return null;
|
||||
}
|
||||
int textLength = editor.getDocument().getTextLength();
|
||||
TextRange range = expressionInfo.getTextRange();
|
||||
if (range.getStartOffset() > range.getEndOffset() || range.getStartOffset() < 0 || range.getEndOffset() > textLength) {
|
||||
LOG.error("invalid range: " + range + ", text length = " + textLength + ", evaluator: " + evaluator);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new XValueHint(project, editor, point, type, expressionInfo, evaluator, session);
|
||||
});
|
||||
return new XValueHint(project, editor, point, type, expressionInfo, evaluator, session);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+8
@@ -30,6 +30,7 @@ import com.intellij.openapi.editor.event.EditorMouseMotionListener;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.xdebugger.XDebuggerUtil;
|
||||
import com.intellij.xdebugger.impl.DebuggerSupport;
|
||||
@@ -138,6 +139,13 @@ public class ValueLookupManager extends EditorMouseAdapter implements EditorMous
|
||||
}
|
||||
|
||||
public void showHint(@NotNull QuickEvaluateHandler handler, @NotNull Editor editor, @NotNull Point point, @NotNull ValueHintType type) {
|
||||
PsiDocumentManager.getInstance(myProject).performWhenAllCommitted(() -> doShowHint(handler, editor, point, type));
|
||||
}
|
||||
|
||||
private void doShowHint(@NotNull QuickEvaluateHandler handler,
|
||||
@NotNull Editor editor,
|
||||
@NotNull Point point,
|
||||
@NotNull ValueHintType type) {
|
||||
myAlarm.cancelAllRequests();
|
||||
if (editor.isDisposed() || !handler.canShowHint(myProject)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user