Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2017-11-06 02:06:42 +0000
committerNathan Ridge2017-11-13 18:22:26 +0000
commit301de3d40ea15dfc84a90c227db62514cd2dc578 (patch)
tree5f01ce1f4ffcee2282133ebf81f376f6afed36fc /core/org.eclipse.cdt.ui/src/org/eclipse
parentb090f32e646527db07ab1b1b4f2374256ec43af9 (diff)
downloadorg.eclipse.cdt-301de3d40ea15dfc84a90c227db62514cd2dc578.tar.gz
org.eclipse.cdt-301de3d40ea15dfc84a90c227db62514cd2dc578.tar.xz
org.eclipse.cdt-301de3d40ea15dfc84a90c227db62514cd2dc578.zip
Bug 522010 - Completion of non-type template parameter in ambiguous template argument
This works around the fact that the optimization introduced in bug 316704 inteferes with the mechanism for offering completions for both alternatives in an ambiguous context. Change-Id: Ibe14c1b4f2f9c9b3394d4635c87424a25fbd7a53
Diffstat (limited to 'core/org.eclipse.cdt.ui/src/org/eclipse')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
index 71f17585c8d..8016c3db7a7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
@@ -36,11 +36,13 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.swt.graphics.Image;
import org.eclipse.cdt.core.dom.ILinkage;
+import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
+import org.eclipse.cdt.core.dom.ast.IASTCompletionNode.CompletionNameEntry;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionStyleMacroParameter;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
@@ -160,9 +162,10 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
}
} else {
boolean handleMacros= false;
- IASTName[] names = completionNode.getNames();
+ CompletionNameEntry[] entries = ((ASTCompletionNode) completionNode).getEntries();
- for (IASTName name : names) {
+ for (CompletionNameEntry entry : entries) {
+ IASTName name = entry.fName;
if (name.getTranslationUnit() == null && !(name instanceof IASTInactiveCompletionName)) {
// The node isn't properly hooked up, must have backtracked out of this node.
// Inactive completion names are special in that they are not hooked up
@@ -171,7 +174,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
continue;
}
- IASTCompletionContext astContext = name.getCompletionContext();
+ IASTCompletionContext astContext = getCompletionContext(name, entry.fParent);
if (astContext == null) {
continue;
} else if (astContext instanceof IASTIdExpression
@@ -203,6 +206,13 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
return proposals;
}
+ private static IASTCompletionContext getCompletionContext(IASTName name, IASTNode parent) {
+ if (parent instanceof IASTCompletionContext) {
+ return (IASTCompletionContext) parent;
+ }
+ return name.getCompletionContext();
+ }
+
/**
* Checks whether the invocation offset is inside or before the preprocessor directive keyword.
*

Back to the top