use of com.intellij.xdebugger.impl.evaluate.quick.common.AbstractValueHint in project intellij-community by JetBrains.
the class XQuickEvaluateHandler method createValueHintAsync.
@NotNull
@Override
public Promise<AbstractValueHint> createValueHintAsync(@NotNull final Project project, @NotNull final Editor editor, @NotNull final Point point, final ValueHintType type) {
final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session == null) {
return Promise.resolve(null);
}
final XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator();
if (evaluator == null) {
return Promise.resolve(null);
}
int offset = AbstractValueHint.calculateOffset(editor, point);
return getExpressionInfo(evaluator, project, type, editor, offset).thenAsync(expressionInfo -> {
AsyncPromise<AbstractValueHint> resultPromise = new AsyncPromise<>();
UIUtil.invokeLaterIfNeeded(() -> {
int textLength = editor.getDocument().getTextLength();
if (expressionInfo == null) {
resultPromise.setResult(null);
return;
}
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);
resultPromise.setResult(null);
return;
}
resultPromise.setResult(new XValueHint(project, editor, point, type, expressionInfo, evaluator, session));
});
return resultPromise;
});
}
Aggregations