mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Patch for Bryan bug 90036. Improve support for namespaces by adding the :: after the namespace name.
This commit is contained in:
parent
00987cb6b2
commit
9b349bc02e
5 changed files with 191 additions and 78 deletions
|
@ -39,10 +39,15 @@ import org.eclipse.cdt.ui.tests.BaseUITestCase;
|
||||||
import org.eclipse.cdt.ui.tests.text.EditorTestHelper;
|
import org.eclipse.cdt.ui.tests.text.EditorTestHelper;
|
||||||
import org.eclipse.cdt.ui.text.ICCompletionProposal;
|
import org.eclipse.cdt.ui.text.ICCompletionProposal;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProposal;
|
||||||
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor;
|
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor;
|
||||||
|
|
||||||
public abstract class AbstractContentAssistTest extends BaseUITestCase {
|
public abstract class AbstractContentAssistTest extends BaseUITestCase {
|
||||||
|
|
||||||
|
public static final int COMPARE_ID_STRINGS = 0;
|
||||||
|
public static final int COMPARE_DISP_STRINGS = 1;
|
||||||
|
public static final int COMPARE_REP_STRINGS = 2;
|
||||||
|
|
||||||
private ICProject fCProject;
|
private ICProject fCProject;
|
||||||
protected IFile fCFile;
|
protected IFile fCFile;
|
||||||
private ITextEditor fEditor;
|
private ITextEditor fEditor;
|
||||||
|
@ -86,7 +91,7 @@ public abstract class AbstractContentAssistTest extends BaseUITestCase {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertContentAssistResults(int offset, String[] expected, boolean isCompletion, boolean compareIdString) throws Exception {
|
protected void assertContentAssistResults(int offset, String[] expected, boolean isCompletion, int compareType) throws Exception {
|
||||||
|
|
||||||
if (CTestPlugin.getDefault().isDebugging()) {
|
if (CTestPlugin.getDefault().isDebugging()) {
|
||||||
System.out.println("\n\n\n\n\nTesting "+this.getClass().getName());
|
System.out.println("\n\n\n\n\nTesting "+this.getClass().getName());
|
||||||
|
@ -105,7 +110,7 @@ public abstract class AbstractContentAssistTest extends BaseUITestCase {
|
||||||
assertTrue(results != null);
|
assertTrue(results != null);
|
||||||
|
|
||||||
results= filterResults(results);
|
results= filterResults(results);
|
||||||
String[] resultStrings= toStringArray(results, compareIdString);
|
String[] resultStrings= toStringArray(results, compareType);
|
||||||
Arrays.sort(expected);
|
Arrays.sort(expected);
|
||||||
Arrays.sort(resultStrings);
|
Arrays.sort(resultStrings);
|
||||||
|
|
||||||
|
@ -170,14 +175,18 @@ public abstract class AbstractContentAssistTest extends BaseUITestCase {
|
||||||
return filtered.toArray();
|
return filtered.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] toStringArray(Object[] results, boolean useIdString) {
|
private String[] toStringArray(Object[] results, int compareType) {
|
||||||
String[] strings= new String[results.length];
|
String[] strings= new String[results.length];
|
||||||
for(int i=0; i< results.length; i++){
|
for(int i=0; i< results.length; i++){
|
||||||
Object result = results[i];
|
Object result = results[i];
|
||||||
if (result instanceof ICCompletionProposal && useIdString) {
|
if (result instanceof ICompletionProposal) {
|
||||||
strings[i]= ((ICCompletionProposal)result).getIdString();
|
if (compareType == COMPARE_ID_STRINGS) {
|
||||||
} else if (result instanceof ICompletionProposal) {
|
strings[i]= ((CCompletionProposal)result).getIdString();
|
||||||
strings[i]= ((ICompletionProposal)result).getDisplayString();
|
} else if (compareType == COMPARE_DISP_STRINGS) {
|
||||||
|
strings[i]= ((CCompletionProposal)result).getDisplayString();
|
||||||
|
} else {
|
||||||
|
strings[i]= ((CCompletionProposal)result).getReplacementString();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
strings[i]= ((IContextInformation)result).getContextDisplayString();
|
strings[i]= ((IContextInformation)result).getContextDisplayString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ public abstract class CompletionProposalsBaseTest extends AbstractContentAssistT
|
||||||
return bodyFile;
|
return bodyFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertCompletionResults(int offset, String[] expected, boolean compareIdString) throws Exception {
|
protected void assertCompletionResults(int offset, String[] expected, int compareType) throws Exception {
|
||||||
assertContentAssistResults(offset, expected, true, compareIdString);
|
assertContentAssistResults(offset, expected, true, compareType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCompletionProposals() throws Exception {
|
public void testCompletionProposals() throws Exception {
|
||||||
String[] expected = getExpectedResultsValues();
|
String[] expected = getExpectedResultsValues();
|
||||||
assertCompletionResults(getCompletionPosition(), expected, false);
|
assertCompletionResults(getCompletionPosition(), expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_DISP_STRINGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -128,8 +128,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
|
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertCompletionResults(int offset, String[] expected, boolean compareIdString) throws Exception {
|
protected void assertCompletionResults(int offset, String[] expected, int compareType) throws Exception {
|
||||||
assertContentAssistResults(offset, expected, true, compareIdString);
|
assertContentAssistResults(offset, expected, true, compareType);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc() {C1 v; v.m/*cursor*/
|
//void gfunc() {C1 v; v.m/*cursor*/
|
||||||
|
@ -139,7 +139,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc() {C1 v; v.fMySelf.m/*cursor*/
|
//void gfunc() {C1 v; v.fMySelf.m/*cursor*/
|
||||||
|
@ -149,7 +150,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc() {C1 v; v.m12().m/*cursor*/
|
//void gfunc() {C1 v; v.m12().m/*cursor*/
|
||||||
|
@ -159,7 +161,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc() {gfC1().m/*cursor*/
|
//void gfunc() {gfC1().m/*cursor*/
|
||||||
|
@ -169,7 +172,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C1::self() {m/*cursor*/
|
//void C1::self() {m/*cursor*/
|
||||||
|
@ -177,7 +181,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)", "m1private(void)"
|
"m123(void)", "m12(void)", "m13(void)", "m1private(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C1::self() {this->m/*cursor*/
|
//void C1::self() {this->m/*cursor*/
|
||||||
|
@ -185,7 +190,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)", "m1private(void)"
|
"m123(void)", "m12(void)", "m13(void)", "m1private(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc() {try{int bla;}catch(C1 v) {v.fMySelf.m/*cursor*/
|
//void gfunc() {try{int bla;}catch(C1 v) {v.fMySelf.m/*cursor*/
|
||||||
|
@ -195,7 +201,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc() {try{int bla;}catch(C2 c){} catch(C1 v) {v.fMySelf.m/*cursor*/
|
//void gfunc() {try{int bla;}catch(C2 c){} catch(C1 v) {v.fMySelf.m/*cursor*/
|
||||||
|
@ -205,7 +212,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {gC/*cursor*/
|
//void f() {gC/*cursor*/
|
||||||
|
@ -213,7 +221,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"gC1", "gC2"
|
"gC1", "gC2"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C1::f() {gC/*cursor*/
|
//void C1::f() {gC/*cursor*/
|
||||||
|
@ -221,7 +230,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"gC1", "gC2"
|
"gC1", "gC2"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C2* cLocal1; while(true) {C1* cLocal2; cL/*cursor*/
|
//void f() {C2* cLocal1; while(true) {C1* cLocal2; cL/*cursor*/
|
||||||
|
@ -229,7 +239,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"cLocal1", "cLocal2"
|
"cLocal1", "cLocal2"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C2::f() {C2* cLocal1; while(true) {C1* cLocal2; cL/*cursor*/
|
//void C2::f() {C2* cLocal1; while(true) {C1* cLocal2; cL/*cursor*/
|
||||||
|
@ -237,7 +248,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"cLocal1", "cLocal2"
|
"cLocal1", "cLocal2"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C2* cLocal1; cLocal1.f/*cursor*/
|
//void f() {C2* cLocal1; cLocal1.f/*cursor*/
|
||||||
|
@ -245,7 +257,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"fMySelf"
|
"fMySelf"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C2::f() {while(true) {f/*cursor*/
|
//void C2::f() {while(true) {f/*cursor*/
|
||||||
|
@ -253,7 +266,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"fMySelf"
|
"fMySelf"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {gf/*cursor*/
|
//void f() {gf/*cursor*/
|
||||||
|
@ -261,7 +275,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"gfC1(void)", "gfC2(void)"
|
"gfC1(void)", "gfC2(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C3::f() {gf/*cursor*/
|
//void C3::f() {gf/*cursor*/
|
||||||
|
@ -269,7 +284,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"gfC1(void)", "gfC2(void)"
|
"gfC1(void)", "gfC2(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C1* l1; l1.m/*cursor*/
|
//void f() {C1* l1; l1.m/*cursor*/
|
||||||
|
@ -279,7 +295,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C3::f() {m/*cursor*/
|
//void C3::f() {m/*cursor*/
|
||||||
|
@ -289,7 +306,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"m123(void)", "m12(void)", "m13(void)"
|
"m123(void)", "m12(void)", "m13(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C/*cursor*/
|
//void f() {C/*cursor*/
|
||||||
|
@ -297,7 +315,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"C1", "C2", "C3"
|
"C1", "C2", "C3"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C2::f() {T/*cursor*/
|
//void C2::f() {T/*cursor*/
|
||||||
|
@ -305,7 +324,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"T1", "T2", "T3", "TClass"
|
"T1", "T2", "T3", "TClass"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//namespace ns {void nsfunc(){C/*cursor*/
|
//namespace ns {void nsfunc(){C/*cursor*/
|
||||||
|
@ -313,7 +333,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"C1", "C2", "C3", "CNS"
|
"C1", "C2", "C3", "CNS"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//namespace ns {void gfunc(){::C/*cursor*/
|
//namespace ns {void gfunc(){::C/*cursor*/
|
||||||
|
@ -321,7 +342,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"C1", "C2", "C3"
|
"C1", "C2", "C3"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {e/*cursor*/
|
//void f() {e/*cursor*/
|
||||||
|
@ -329,7 +351,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"e11", "e12", "E1"
|
"e11", "e12", "E1"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void C3::f() {e/*cursor*/
|
//void C3::f() {e/*cursor*/
|
||||||
|
@ -337,7 +360,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"e11", "e12", "e21", "e22", "E1", "E2"
|
"e11", "e12", "e21", "e22", "E1", "E2"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C3* l1; l1.C/*cursor*/
|
//void f() {C3* l1; l1.C/*cursor*/
|
||||||
|
@ -346,7 +370,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"C3", "C2", "C1"
|
"C3", "C2", "C1"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C2* l1; l1.C/*cursor*/
|
//void f() {C2* l1; l1.C/*cursor*/
|
||||||
|
@ -355,7 +380,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"C2", "C1"
|
"C2", "C1"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C3* l1; l1.C3::fMySelf.iam/*cursor*/
|
//void f() {C3* l1; l1.C3::fMySelf.iam/*cursor*/
|
||||||
|
@ -364,7 +390,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam3(void)", "iam2(void)", "iam1(void)"
|
"iam3(void)", "iam2(void)", "iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C3* l1; l1.C2::fMySelf.iam/*cursor*/
|
//void f() {C3* l1; l1.C2::fMySelf.iam/*cursor*/
|
||||||
|
@ -373,7 +400,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam2(void)", "iam1(void)"
|
"iam2(void)", "iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C3* l1; l1.C1::fMySelf.iam/*cursor*/
|
//void f() {C3* l1; l1.C1::fMySelf.iam/*cursor*/
|
||||||
|
@ -381,7 +409,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C3* l1; l1.T3::fMySelf.iam/*cursor*/
|
//void f() {C3* l1; l1.T3::fMySelf.iam/*cursor*/
|
||||||
|
@ -390,7 +419,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam3(void)", "iam2(void)", "iam1(void)"
|
"iam3(void)", "iam2(void)", "iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C3* l1; l1.T2::fMySelf.iam/*cursor*/
|
//void f() {C3* l1; l1.T2::fMySelf.iam/*cursor*/
|
||||||
|
@ -399,7 +429,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam2(void)", "iam1(void)"
|
"iam2(void)", "iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C3* l1; l1.T1::fMySelf.iam/*cursor*/
|
//void f() {C3* l1; l1.T1::fMySelf.iam/*cursor*/
|
||||||
|
@ -407,7 +438,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C1().iam/*cursor*/
|
//void f() {C1().iam/*cursor*/
|
||||||
|
@ -415,7 +447,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C1 c; (&c)->iam/*cursor*/
|
//void f() {C1 c; (&c)->iam/*cursor*/
|
||||||
|
@ -423,7 +456,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C1* c; (*c).iam/*cursor*/
|
//void f() {C1* c; (*c).iam/*cursor*/
|
||||||
|
@ -431,7 +465,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C1** c; (**c).iam/*cursor*/
|
//void f() {C1** c; (**c).iam/*cursor*/
|
||||||
|
@ -439,14 +474,16 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1** c; (*c)->iam/*cursor*/
|
//void f() {C1** c; (*c)->iam/*cursor*/
|
||||||
public void testDereferencingOperator3() throws Exception {
|
public void testDereferencingOperator3() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C1* c; c[0].iam/*cursor*/
|
//void f() {C1* c; c[0].iam/*cursor*/
|
||||||
|
@ -454,28 +491,32 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1** c; c[0][1].iam/*cursor*/
|
//void f() {C1** c; c[0][1].iam/*cursor*/
|
||||||
public void testArrayAccessOperator2() throws Exception {
|
public void testArrayAccessOperator2() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1** c; c[0]->iam/*cursor*/
|
//void f() {C1** c; c[0]->iam/*cursor*/
|
||||||
public void testArrayAccessOperator3() throws Exception {
|
public void testArrayAccessOperator3() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1* c; (&c[0])->iam/*cursor*/
|
//void f() {C1* c; (&c[0])->iam/*cursor*/
|
||||||
public void testArrayAccessOperator4() throws Exception {
|
public void testArrayAccessOperator4() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {void* c; ((C1*)c)->iam/*cursor*/
|
//void f() {void* c; ((C1*)c)->iam/*cursor*/
|
||||||
|
@ -483,14 +524,16 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void g(int a) {}; void f() {void* c; g(((C1*)c)->iam/*cursor*/
|
//void g(int a) {}; void f() {void* c; g(((C1*)c)->iam/*cursor*/
|
||||||
public void testCasts2() throws Exception {
|
public void testCasts2() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {C1* c; c++->iam/*cursor*/
|
//void f() {C1* c; c++->iam/*cursor*/
|
||||||
|
@ -498,35 +541,40 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1* c; (*++c).iam/*cursor*/
|
//void f() {C1* c; (*++c).iam/*cursor*/
|
||||||
public void testPointerArithmetic2() throws Exception {
|
public void testPointerArithmetic2() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1* c; c--->iam/*cursor*/
|
//void f() {C1* c; c--->iam/*cursor*/
|
||||||
public void testPointerArithmetic3() throws Exception {
|
public void testPointerArithmetic3() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1 c; (&c+1)->iam/*cursor*/
|
//void f() {C1 c; (&c+1)->iam/*cursor*/
|
||||||
public void testPointerArithmetic4() throws Exception {
|
public void testPointerArithmetic4() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void f() {C1 c; (&c-1)->iam/*cursor*/
|
//void f() {C1 c; (&c-1)->iam/*cursor*/
|
||||||
public void testPointerArithmetic5() throws Exception {
|
public void testPointerArithmetic5() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"iam1(void)"
|
"iam1(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {int localVar=0; if (*cond && somefunc(&local/*cursor*/
|
//void f() {int localVar=0; if (*cond && somefunc(&local/*cursor*/
|
||||||
|
@ -534,7 +582,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"localVar"
|
"localVar"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//int a[] = {1,2}; void f(int _0306_b) {_0306_b/*cursor*/
|
//int a[] = {1,2}; void f(int _0306_b) {_0306_b/*cursor*/
|
||||||
|
@ -542,14 +591,16 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"_0306_b"
|
"_0306_b"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//int a[] = {1,2}; void f(int b) {int _0306_b[] = {2,3}; _0306_b/*cursor*/
|
//int a[] = {1,2}; void f(int b) {int _0306_b[] = {2,3}; _0306_b/*cursor*/
|
||||||
public void testCuttingInput2() throws Exception {
|
public void testCuttingInput2() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"_0306_b"
|
"_0306_b"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//enum EnumType function() {int _031209_v; _031209/*cursor*/
|
//enum EnumType function() {int _031209_v; _031209/*cursor*/
|
||||||
|
@ -557,7 +608,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"_031209_v"
|
"_031209_v"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//namespace ns {void x() {NSCO/*cursor*/
|
//namespace ns {void x() {NSCO/*cursor*/
|
||||||
|
@ -565,14 +617,16 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"NSCONST"
|
"NSCONST"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
//void ns::CNS::mcns(){NSCO/*cursor*/
|
//void ns::CNS::mcns(){NSCO/*cursor*/
|
||||||
public void testAccessToNamespaceFromClassMember2() throws Exception {
|
public void testAccessToNamespaceFromClassMember2() throws Exception {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"NSCONST"
|
"NSCONST"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//#i/*cursor*/
|
//#i/*cursor*/
|
||||||
|
@ -580,7 +634,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"#if", "#ifdef", "#ifndef", "#include"
|
"#if", "#ifdef", "#ifndef", "#include"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc(){TClass<int> t(0); t./*cursor*/
|
//void gfunc(){TClass<int> t(0); t./*cursor*/
|
||||||
|
@ -589,7 +644,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"add(T)"
|
"add(T)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void gfunc(){C3 c3; c3.t/*cursor*/
|
//void gfunc(){C3 c3; c3.t/*cursor*/
|
||||||
|
@ -599,7 +655,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
"tConvert(void)"
|
"tConvert(void)"
|
||||||
// "tConvert<T>(void)"
|
// "tConvert<T>(void)"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//using namespace ns;void gfunc(){NSC/*cursor*/
|
//using namespace ns;void gfunc(){NSC/*cursor*/
|
||||||
|
@ -607,6 +664,25 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= {
|
final String[] expected= {
|
||||||
"NSCONST"
|
"NSCONST"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset, expected, true);
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
//void gfunc(){n/*cursor*/
|
||||||
|
public void testAutoColons() throws Exception {
|
||||||
|
final String[] expected= {
|
||||||
|
"ns::"
|
||||||
|
};
|
||||||
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
//using namespace /*cursor*/
|
||||||
|
public void testAutoColons2() throws Exception {
|
||||||
|
final String[] expected= {
|
||||||
|
"ns"
|
||||||
|
};
|
||||||
|
assertCompletionResults(fCursorOffset, expected,
|
||||||
|
AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,8 @@ public class ParameterHintTests extends AbstractContentAssistTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertParameterHints(String[] expected) throws Exception {
|
protected void assertParameterHints(String[] expected) throws Exception {
|
||||||
assertContentAssistResults(getBuffer().length() - 1, expected, false, false);
|
assertContentAssistResults(getBuffer().length() - 1, expected, false,
|
||||||
|
AbstractContentAssistTest.COMPARE_ID_STRINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void foo(){aFunc(
|
//void foo(){aFunc(
|
||||||
|
|
|
@ -40,6 +40,9 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
@ -200,12 +203,16 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
if (!isAnonymousBinding(binding)) {
|
if (!isAnonymousBinding(binding)) {
|
||||||
if (binding instanceof ICPPClassType) {
|
if (binding instanceof ICPPClassType) {
|
||||||
handleClass((ICPPClassType) binding, cContext, proposals);
|
handleClass((ICPPClassType) binding, cContext, proposals);
|
||||||
} else if (binding instanceof IFunction) {
|
} else if (binding instanceof IFunction) {
|
||||||
handleFunction((IFunction)binding, cContext, proposals);
|
handleFunction((IFunction)binding, cContext, proposals);
|
||||||
} else if (binding instanceof IVariable) {
|
|
||||||
handleVariable((IVariable) binding, cContext, proposals);
|
|
||||||
} else if (!cContext.isContextInformationStyle()) {
|
} else if (!cContext.isContextInformationStyle()) {
|
||||||
proposals.add(createProposal(binding.getName(), binding.getName(), getImage(binding), cContext));
|
if (binding instanceof IVariable) {
|
||||||
|
handleVariable((IVariable) binding, cContext, proposals);
|
||||||
|
} else if (binding instanceof ICPPNamespace) {
|
||||||
|
handleNamespace((ICPPNamespace) binding, astContext, cContext, proposals);
|
||||||
|
} else {
|
||||||
|
proposals.add(createProposal(binding.getName(), binding.getName(), getImage(binding), cContext));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,8 +321,6 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleVariable(IVariable variable, CContentAssistInvocationContext context, List proposals) {
|
private void handleVariable(IVariable variable, CContentAssistInvocationContext context, List proposals) {
|
||||||
if (context.isContextInformationStyle()) return;
|
|
||||||
|
|
||||||
StringBuffer repStringBuff = new StringBuffer();
|
StringBuffer repStringBuff = new StringBuffer();
|
||||||
repStringBuff.append(variable.getName());
|
repStringBuff.append(variable.getName());
|
||||||
|
|
||||||
|
@ -344,6 +349,28 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
proposals.add(proposal);
|
proposals.add(proposal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleNamespace(ICPPNamespace namespace,
|
||||||
|
IASTCompletionContext astContext,
|
||||||
|
CContentAssistInvocationContext cContext, List proposals) {
|
||||||
|
if (astContext instanceof ICPPASTQualifiedName) {
|
||||||
|
IASTCompletionContext parent = ((ICPPASTQualifiedName) astContext)
|
||||||
|
.getCompletionContext();
|
||||||
|
handleNamespace(namespace, parent, cContext, proposals);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer repStringBuff = new StringBuffer();
|
||||||
|
repStringBuff.append(namespace.getName());
|
||||||
|
|
||||||
|
if (!(astContext instanceof ICPPASTUsingDeclaration)
|
||||||
|
&& !(astContext instanceof ICPPASTUsingDirective)) {
|
||||||
|
repStringBuff.append("::"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
String repString = repStringBuff.toString();
|
||||||
|
proposals.add(createProposal(repString, namespace.getName(), getImage(namespace), cContext));
|
||||||
|
}
|
||||||
|
|
||||||
private CCompletionProposal createProposal(String repString, String dispString, Image image, CContentAssistInvocationContext context) {
|
private CCompletionProposal createProposal(String repString, String dispString, Image image, CContentAssistInvocationContext context) {
|
||||||
return createProposal(repString, dispString, null, image, context);
|
return createProposal(repString, dispString, null, image, context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue