summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-05-01 02:42:19 -0400
committerNathan Ridge2018-05-10 22:44:54 -0400
commit3ad16b909ce95580136743f59c539fa5f41f27ea (patch)
tree80fc3c6bb4b958344ea089ac83126f3891202868
parent4881a2ecd42d20dbb5e785801b122daa27f36799 (diff)
downloadorg.eclipse.cdt-3ad16b909ce95580136743f59c539fa5f41f27ea.zip
org.eclipse.cdt-3ad16b909ce95580136743f59c539fa5f41f27ea.tar.gz
org.eclipse.cdt-3ad16b909ce95580136743f59c539fa5f41f27ea.tar.xz
Bug 534189 - Do not wait for the editor's shared AST to generate parameter guesses
We want to hold the index read lock while generating the guesses, but we don't need an AST; we already have the one built for content assist. Change-Id: I5a60aaca24ce345f5ae387664e025e6fa39cd9d2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java
index c9f724e..28cf08d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java
@@ -45,6 +45,7 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.texteditor.link.EditorLinkedModeUI;
+import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunction;
@@ -78,6 +79,7 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
private char[][] fParametersNames;
private IType[] fParametersTypes;
private List<IBinding> fAssignableElements;
+ private IASTCompletionNode fCompletionNode;
public static ParameterGuessingProposal createProposal(CContentAssistInvocationContext context,
List<IBinding> availableElements, CCompletionProposal proposal, IFunction function,
@@ -118,7 +120,7 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
ParameterGuessingProposal ret = new ParameterGuessingProposal(replacement, replacementOffset,
replacementLength, proposal.getImage(), proposal.getDisplayString(), proposal.getIdString(),
proposal.getRelevance(), context.getViewer(), function, invocationOffset, parseOffset,
- context.getTranslationUnit(), document);
+ context.getTranslationUnit(), document, context.getCompletionNode());
ret.setContextInformation(proposal.getContextInformation());
ret.fFullPrefix = fullPrefix;
ret.fCEditor = getCEditor(context.getEditor());
@@ -147,9 +149,10 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
public ParameterGuessingProposal(String replacementString, int replacementOffset, int replacementLength,
Image image, String displayString, String idString, int relevance, ITextViewer viewer,
IFunction function, int invocationOffset, int parseOffset, ITranslationUnit tu,
- IDocument document) {
+ IDocument document, IASTCompletionNode completionNode) {
super(replacementString, replacementOffset, replacementLength, image, displayString, idString,
relevance, viewer, function, invocationOffset, parseOffset, tu, document);
+ fCompletionNode = completionNode;
}
/**
@@ -254,14 +257,12 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
}
public void generateParameterGuesses() {
- IStatus status = ASTProvider.getASTProvider().runOnAST(fTranslationUnit, ASTProvider.WAIT_ACTIVE_ONLY,
+ IStatus status = ASTProvider.getASTProvider().runOnAST(fTranslationUnit, ASTProvider.WAIT_NO,
new NullProgressMonitor(), new ASTRunnable() {
@Override
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit astRoot) throws CoreException {
- if (astRoot == null)
- return Status.CANCEL_STATUS;
try {
- CPPSemantics.pushLookupPoint(astRoot);
+ CPPSemantics.pushLookupPoint(fCompletionNode.getTranslationUnit());
guessParameters();
} catch (Exception e) {
CUIPlugin.log(e);