mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 18:55:38 +02:00
Fix for 174809, anonymous types in content assist.
This commit is contained in:
parent
a9aa8b8cba
commit
335ae395bd
2 changed files with 17 additions and 9 deletions
|
@ -27,7 +27,7 @@ public class CompletionTest_AnonymousTypes extends CompletionProposalsBaseTest{
|
||||||
public CompletionTest_AnonymousTypes(String name) {
|
public CompletionTest_AnonymousTypes(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=174809
|
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=174809
|
||||||
setExpectFailure(174809);
|
// setExpectFailure(174809);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.text.contentassist;
|
package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
|
|
||||||
|
@ -196,17 +197,24 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
protected void handleBinding(IBinding binding,
|
protected void handleBinding(IBinding binding,
|
||||||
CContentAssistInvocationContext cContext,
|
CContentAssistInvocationContext cContext,
|
||||||
IASTCompletionContext astContext, List proposals) {
|
IASTCompletionContext astContext, List proposals) {
|
||||||
if (binding instanceof ICPPClassType) {
|
if (!isAnonymousBinding(binding)) {
|
||||||
handleClass((ICPPClassType) binding, cContext, proposals);
|
if (binding instanceof ICPPClassType) {
|
||||||
} else if (binding instanceof IFunction) {
|
handleClass((ICPPClassType) binding, cContext, proposals);
|
||||||
handleFunction((IFunction)binding, cContext, proposals);
|
} else if (binding instanceof IFunction) {
|
||||||
} else if (binding instanceof IVariable) {
|
handleFunction((IFunction)binding, cContext, proposals);
|
||||||
handleVariable((IVariable) binding, cContext, proposals);
|
} else if (binding instanceof IVariable) {
|
||||||
} else if (!cContext.isContextInformationStyle()) {
|
handleVariable((IVariable) binding, cContext, proposals);
|
||||||
proposals.add(createProposal(binding.getName(), binding.getName(), getImage(binding), cContext));
|
} else if (!cContext.isContextInformationStyle()) {
|
||||||
|
proposals.add(createProposal(binding.getName(), binding.getName(), getImage(binding), cContext));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isAnonymousBinding(IBinding binding) {
|
||||||
|
char[] name= binding.getNameCharArray();
|
||||||
|
return name.length == 0 || name[0] == '{';
|
||||||
|
}
|
||||||
|
|
||||||
private void handleClass(ICPPClassType classType, CContentAssistInvocationContext context, List proposals) {
|
private void handleClass(ICPPClassType classType, CContentAssistInvocationContext context, List proposals) {
|
||||||
if (context.isContextInformationStyle()) {
|
if (context.isContextInformationStyle()) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue