mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content Assist Work: More JUnit tests
This commit is contained in:
parent
0f7f7e0b13
commit
d4ca6eb809
21 changed files with 1032 additions and 35 deletions
|
@ -55,9 +55,6 @@ public interface IASTCompletionNode {
|
|||
// any place where exclusively a preprocessor macro name would be expected
|
||||
public static final CompletionKind MACRO_REFERENCE = new CompletionKind( 10 );
|
||||
|
||||
// any place where function arguments are expected
|
||||
public static final CompletionKind FUNCTION_REFERENCE = new CompletionKind( 11 );
|
||||
|
||||
// any place where constructor arguments are expected
|
||||
public static final CompletionKind CONSTRUCTOR_REFERENCE = new CompletionKind( 12 );
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2004-01-26 Hoda Amer
|
||||
More Completion JUnit tests.
|
||||
|
||||
2004-01-23 Hoda Amer
|
||||
More Completion JUnit tests.
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
void foo ( a
|
|
@ -0,0 +1,3 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
void foo (
|
|
@ -0,0 +1,6 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
class ClassA {
|
||||
void foo ( a
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
class ClassA {
|
||||
void foo (
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
void anotherClass::anotherMethod()
|
||||
{
|
||||
try {
|
||||
} catch (
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
class ClassA : public a
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
class ClassA : public
|
|
@ -0,0 +1,8 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
void anotherClass::anotherMethod()
|
||||
{
|
||||
try {
|
||||
} catch ( a
|
||||
|
||||
}
|
|
@ -42,6 +42,10 @@ public class AutomatedSuite extends TestSuite {
|
|||
addTest(CompletionTest_FieldType_NoPrefix2.suite());
|
||||
addTest(CompletionTest_VariableType_Prefix.suite());
|
||||
addTest(CompletionTest_VariableType_NoPrefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix_Bug50642.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix2_Bug50642.suite());
|
||||
addTest(CompletionTest_ArgumentType_Prefix_Bug50642.suite());
|
||||
addTest(CompletionTest_ArgumentType_NoPrefix2_Bug50642.suite());
|
||||
addTest(CompletionTest_StatementStart_Prefix.suite());
|
||||
addTest(CompletionTest_StatementStart_NoPrefix.suite());
|
||||
addTest(CompletionTest_SingleName_Prefix.suite());
|
||||
|
@ -60,6 +64,10 @@ public class AutomatedSuite extends TestSuite {
|
|||
addTest(CompletionFailedTest_NamespaceRef_Prefix_Bug50471.suite());
|
||||
addTest(CompletionFailedTest_MacroRef_NoPrefix_Bug50487.suite());
|
||||
addTest(CompletionFailedTest_MacroRef_Prefix_Bug50487.suite());
|
||||
addTest(CompletionFailedTest_ClassReference_NoPrefix_Bug50621.suite());
|
||||
addTest(CompletionFailedTest_ClassReference_Prefix_Bug50621.suite());
|
||||
addTest(CompletionFailedTest_ExceptionReference_NoPrefix_Bug50640.suite());
|
||||
addTest(CompletionFailedTest_ExceptionReference_Prefix_Bug50640.suite());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Class_Reference, with No prefix
|
||||
* Bug#50621 :Wrong completion kind in a class declaration
|
||||
*
|
||||
*/
|
||||
public class CompletionFailedTest_ClassReference_NoPrefix_Bug50621 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart8.h";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.USER_SPECIFIED_NAME; // sould be CompletionKind.CLASS_REFERENCE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass",
|
||||
// "xOtherClass"
|
||||
};
|
||||
|
||||
public CompletionFailedTest_ClassReference_NoPrefix_Bug50621(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionFailedTest_ClassReference_NoPrefix_Bug50621.class.getName());
|
||||
suite.addTest(new CompletionFailedTest_ClassReference_NoPrefix_Bug50621("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Class_Reference, with prefix
|
||||
* Bug#50621 :Wrong completion kind in a class declaration
|
||||
*
|
||||
*/
|
||||
public class CompletionFailedTest_ClassReference_Prefix_Bug50621 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart7.h";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.USER_SPECIFIED_NAME; // sould be CompletionKind.CLASS_REFERENCE;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass"
|
||||
};
|
||||
|
||||
public CompletionFailedTest_ClassReference_Prefix_Bug50621(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionFailedTest_ClassReference_Prefix_Bug50621.class.getName());
|
||||
suite.addTest(new CompletionFailedTest_ClassReference_Prefix_Bug50621("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" a ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Exception_Reference, with No prefix
|
||||
* Bug#50640 : Wrong completion kind when expecting an exception
|
||||
*
|
||||
*/
|
||||
public class CompletionFailedTest_ExceptionReference_NoPrefix_Bug50640 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart10.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCodeScope"; // should be "ASTMethod";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.STATEMENT_START; // should be CompletionKind.EXCEPTION_REFERENCE ;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass",
|
||||
// "aNamespace",
|
||||
// "anEnumeration",
|
||||
// "AStruct",
|
||||
// "..."
|
||||
};
|
||||
|
||||
public CompletionFailedTest_ExceptionReference_NoPrefix_Bug50640(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionFailedTest_ExceptionReference_NoPrefix_Bug50640.class.getName());
|
||||
suite.addTest(new CompletionFailedTest_ExceptionReference_NoPrefix_Bug50640("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Exception_Reference, with prefix
|
||||
* Bug#50640 : Wrong completion kind when expecting an exception
|
||||
*
|
||||
*/
|
||||
public class CompletionFailedTest_ExceptionReference_Prefix_Bug50640 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart9.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.SINGLE_NAME_REFERENCE; // should be CompletionKind.EXCEPTION_REFERENCE ;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass",
|
||||
// "aNamespace",
|
||||
// "anEnumeration",
|
||||
// "AStruct"
|
||||
};
|
||||
|
||||
public CompletionFailedTest_ExceptionReference_Prefix_Bug50640(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionFailedTest_ExceptionReference_Prefix_Bug50640.class.getName());
|
||||
suite.addTest(new CompletionFailedTest_ExceptionReference_Prefix_Bug50640("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" a ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Argument_Type completion kind , with No prefix
|
||||
* Bug#50642 : Wrong completion kind when declaring an argument type
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_ArgumentType_NoPrefix2_Bug50642 extends CompletionProposalsBaseTest{
|
||||
private final String fileName = "CompletionTestStart19.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTClassSpecifier";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.FIELD_TYPE; // should be CompletionKind.ARGUMENT_TYPE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
};
|
||||
|
||||
public CompletionTest_ArgumentType_NoPrefix2_Bug50642(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionTest_ArgumentType_NoPrefix2_Bug50642.class.getName());
|
||||
suite.addTest(new CompletionTest_ArgumentType_NoPrefix2_Bug50642("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Argument_Type completion kind , with No prefix
|
||||
* Bug#50642 : Wrong completion kind when declaring an argument type
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_ArgumentType_NoPrefix_Bug50642 extends CompletionProposalsBaseTest{
|
||||
private final String fileName = "CompletionTestStart17.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.ARGUMENT_TYPE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
};
|
||||
|
||||
public CompletionTest_ArgumentType_NoPrefix_Bug50642(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionTest_ArgumentType_NoPrefix_Bug50642.class.getName());
|
||||
suite.addTest(new CompletionTest_ArgumentType_NoPrefix_Bug50642("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Argument_Type completion kind , with a prefix
|
||||
* Bug#50642 : Wrong completion kind when declaring an argument type
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_ArgumentType_Prefix2_Bug50642 extends CompletionProposalsBaseTest{
|
||||
private final String fileName = "CompletionTestStart18.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTClassSpecifier";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.FIELD_TYPE; // should be CompletionKind.ARGUMENT_TYPE;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
"aClass",
|
||||
"anotherClass",
|
||||
"aNamespace",
|
||||
"anEnumeration",
|
||||
"AStruct"
|
||||
};
|
||||
|
||||
public CompletionTest_ArgumentType_Prefix2_Bug50642(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionTest_ArgumentType_Prefix2_Bug50642.class.getName());
|
||||
suite.addTest(new CompletionTest_ArgumentType_Prefix2_Bug50642("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" a ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Argument_Type completion kind , with a prefix
|
||||
* Bug#50642 : Wrong completion kind when declaring an argument type
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_ArgumentType_Prefix_Bug50642 extends CompletionProposalsBaseTest{
|
||||
private final String fileName = "CompletionTestStart16.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.ARGUMENT_TYPE;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
"aClass",
|
||||
"anotherClass",
|
||||
"aNamespace",
|
||||
"anEnumeration",
|
||||
"AStruct"
|
||||
};
|
||||
|
||||
public CompletionTest_ArgumentType_Prefix_Bug50642(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionTest_ArgumentType_Prefix_Bug50642.class.getName());
|
||||
suite.addTest(new CompletionTest_ArgumentType_Prefix_Bug50642("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" a ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
2004-01-26 Hoda Amer
|
||||
Content Assist Work: More Tuning of Completion Engine
|
||||
|
||||
2004-01-23 Hoda Amer
|
||||
Content Assist Work: Tuning of Completion Engine
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
kinds[6] = IASTNode.LookupKind.FUNCTIONS;
|
||||
kinds[7] = IASTNode.LookupKind.LOCAL_VARIABLES;
|
||||
|
||||
result = lookup (searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
result = lookup (searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions (result);
|
||||
|
||||
List macros = lookupMacros(completionNode.getCompletionPrefix());
|
||||
|
@ -529,10 +529,11 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
if(completionNode.getCompletionPrefix().length() > 0 ) {
|
||||
// 2. Lookup all types that could be used here
|
||||
ILookupResult result;
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[2];
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[3];
|
||||
kinds[0] = IASTNode.LookupKind.STRUCTURES;
|
||||
kinds[1] = IASTNode.LookupKind.ENUMERATIONS;
|
||||
result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
kinds[2] = IASTNode.LookupKind.NAMESPACES;
|
||||
result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions(result);
|
||||
} else // prefix is empty, we can not look for everything
|
||||
{
|
||||
|
@ -544,13 +545,6 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// 1. basic completion on all types
|
||||
completionOnTypeReference(completionNode);
|
||||
// 2. Get the search scope node
|
||||
if(completionNode.getCompletionPrefix().length() > 0) {
|
||||
IASTScope searchNode = completionNode.getCompletionScope();
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||
kinds[0] = IASTNode.LookupKind.NAMESPACES;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
addToCompletions(result);
|
||||
}
|
||||
// TODO
|
||||
// 3. provide a template for constructor/ destructor
|
||||
// 4. lookup methods
|
||||
|
@ -566,14 +560,6 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
private void completionOnVariableType(IASTCompletionNode completionNode){
|
||||
// 1. basic completion on all types
|
||||
completionOnTypeReference(completionNode);
|
||||
// look for namespaces only if you have a prefix
|
||||
if(completionNode.getCompletionPrefix().length() > 0){
|
||||
IASTScope searchNode = completionNode.getCompletionScope();
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||
kinds[0] = IASTNode.LookupKind.NAMESPACES;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
addToCompletions(result);
|
||||
}
|
||||
}
|
||||
|
||||
private void completionOnSingleNameReference(IASTCompletionNode completionNode){
|
||||
|
@ -595,7 +581,7 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
String prefix = completionNode.getCompletionPrefix();
|
||||
if(prefix.equals("("))
|
||||
prefix = "";
|
||||
ILookupResult result = lookup(searchNode, prefix, kinds, completionNode.getCompletionContext());
|
||||
ILookupResult result = lookup(searchNode, prefix, kinds, null);
|
||||
addToCompletions(result);
|
||||
|
||||
List macros = lookupMacros(completionNode.getCompletionPrefix());
|
||||
|
@ -609,7 +595,7 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// only look for classes
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||
kinds[0] = IASTNode.LookupKind.CLASSES;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions(result);
|
||||
}
|
||||
private void completionOnNamespaceReference(IASTCompletionNode completionNode){
|
||||
|
@ -618,7 +604,7 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// only look for namespaces
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||
kinds[0] = IASTNode.LookupKind.NAMESPACES;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions(result);
|
||||
}
|
||||
private void completionOnExceptionReference(IASTCompletionNode completionNode){
|
||||
|
@ -636,16 +622,14 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
List result = lookupMacros(completionNode.getCompletionPrefix());
|
||||
addMacrosToCompletions(result.iterator());
|
||||
}
|
||||
private void completionOnFunctionReference(IASTCompletionNode completionNode){
|
||||
// TODO: complete the lookups
|
||||
}
|
||||
private void completionOnConstructorReference(IASTCompletionNode completionNode){
|
||||
// 1. Get the search scope node
|
||||
IASTScope searchNode = completionNode.getCompletionScope();
|
||||
// only lookup constructors
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||
kinds[0] = IASTNode.LookupKind.CONSTRUCTORS;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions(result);
|
||||
}
|
||||
private void completionOnKeyword(IASTCompletionNode completionNode){
|
||||
|
@ -734,10 +718,6 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// CompletionOnMacroReference
|
||||
completionOnMacroReference(completionNode);
|
||||
}
|
||||
else if(kind == CompletionKind.FUNCTION_REFERENCE){
|
||||
// completionOnFunctionReference
|
||||
completionOnFunctionReference(completionNode);
|
||||
}
|
||||
else if(kind == CompletionKind.CONSTRUCTOR_REFERENCE){
|
||||
// completionOnConstructorReference
|
||||
completionOnConstructorReference(completionNode);
|
||||
|
@ -782,8 +762,6 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
kindStr = "EXCEPTION_REFERENCE";
|
||||
else if(kind == IASTCompletionNode.CompletionKind.MACRO_REFERENCE)
|
||||
kindStr = "MACRO_REFERENCE";
|
||||
else if(kind == IASTCompletionNode.CompletionKind.FUNCTION_REFERENCE)
|
||||
kindStr = "FUNCTION_REFERENCE";
|
||||
else if(kind == IASTCompletionNode.CompletionKind.CONSTRUCTOR_REFERENCE)
|
||||
kindStr = "CONSTRUCTOR_REFERENCE";
|
||||
else if(kind == IASTCompletionNode.CompletionKind.KEYWORD)
|
||||
|
|
Loading…
Add table
Reference in a new issue