PsiElement (Project project, final PsiElement originalContext) { if (project.isDefault()) return originalContext; //TODO [egor] : does not work for anything other than java anyway, see IDEA-132677 if (!(myDelegate instanceof DefaultCodeFragmentFactory)) { return originalContext; } PsiElement context = originalContext; XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); if (session != null) { XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers(); Map<?, ValueMarkup> markupMap = markers != null ? markers.getAllMarkers() : null; if (!ContainerUtil.isEmpty(markupMap)) { Pair<String, Map<String, ObjectReference>> markupVariables = createMarkupVariablesText(markupMap); String text = markupVariables.getFirst(); if (!StringUtil.isEmpty(text)) { PsiCodeBlock codeFragment = JavaPsiFacade.getElementFactory(project).createCodeBlockFromText("{" + text + "}", context); codeFragment.accept(new JavaRecursiveElementVisitor() { @Override public void visitLocalVariable(@NotNull PsiLocalVariable variable) { final String name = variable.getName(); variable.putUserData(LABEL_VARIABLE_VALUE_KEY, markupVariables.getSecond().get(name)); } }); context = codeFragment; } } } return context; }