mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-170899 Evaluate lambdas does not work with marked values
This commit is contained in:
+14
-20
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,10 +22,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.JavaCodeFragment;
|
||||
import com.intellij.psi.JavaRecursiveElementVisitor;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiLocalVariable;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.DelegatingGlobalSearchScope;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
@@ -104,21 +101,19 @@ public class CodeFragmentFactoryContextWrapper extends CodeFragmentFactory {
|
||||
if (session != null) {
|
||||
XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
|
||||
Map<?, ValueMarkup> markupMap = markers != null ? markers.getAllMarkers() : null;
|
||||
//final Map<ObjectReference, ValueMarkup> markupMap = ValueDescriptorImpl.getMarkupMap(process);
|
||||
if (!ContainerUtil.isEmpty(markupMap)) {
|
||||
final Pair<String, Map<String, ObjectReference>> markupVariables = createMarkupVariablesText(markupMap);
|
||||
int offset = markupVariables.getFirst().length() - 1;
|
||||
final TextWithImportsImpl textWithImports = new TextWithImportsImpl(CodeFragmentKind.CODE_BLOCK, markupVariables.getFirst(), "", myDelegate.getFileType());
|
||||
final JavaCodeFragment codeFragment = myDelegate.createCodeFragment(textWithImports, context, project);
|
||||
codeFragment.accept(new JavaRecursiveElementVisitor() {
|
||||
public void visitLocalVariable(PsiLocalVariable variable) {
|
||||
final String name = variable.getName();
|
||||
variable.putUserData(LABEL_VARIABLE_VALUE_KEY, markupVariables.getSecond().get(name));
|
||||
}
|
||||
});
|
||||
final PsiElement newContext = codeFragment.findElementAt(offset);
|
||||
if (newContext != null) {
|
||||
context = newContext;
|
||||
Pair<String, Map<String, ObjectReference>> markupVariables = createMarkupVariablesText(markupMap);
|
||||
String text = markupVariables.getFirst();
|
||||
if (!StringUtil.isEmpty(text)) {
|
||||
PsiCodeBlock codeFragment =
|
||||
JavaPsiFacade.getInstance(project).getElementFactory().createCodeBlockFromText("{" + text + "}", context);
|
||||
codeFragment.accept(new JavaRecursiveElementVisitor() {
|
||||
public void visitLocalVariable(PsiLocalVariable variable) {
|
||||
final String name = variable.getName();
|
||||
variable.putUserData(LABEL_VARIABLE_VALUE_KEY, markupVariables.getSecond().get(name));
|
||||
}
|
||||
});
|
||||
context = codeFragment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,7 +144,6 @@ public class CodeFragmentFactoryContextWrapper extends CodeFragmentFactory {
|
||||
//it.remove();
|
||||
}
|
||||
}
|
||||
buffer.append(" ");
|
||||
return Pair.create(buffer.toString(), reverseMap);
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user