1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

fix bug 62344

This commit is contained in:
Andrew Niefer 2004-05-14 21:07:03 +00:00
parent 08ca38925b
commit e8b1740a4f
3 changed files with 21 additions and 2 deletions

View file

@ -1037,4 +1037,16 @@ public class CompletionParseTest extends CompletionParseBaseTest {
assertEquals( node.getCompletionKind(), CompletionKind.SINGLE_NAME_REFERENCE );
}
public void testBug62344() throws Exception
{
Writer writer = new StringWriter();
writer.write( " namespace Foo{ class bar{}; } ");
writer.write( " void main() { ");
writer.write( " Foo::bar * foobar = new Foo::SP ");
String code = writer.toString();
IASTCompletionNode node = parse( code, code.indexOf( "SP" ) );
assertEquals( node.getCompletionKind(), CompletionKind.NEW_TYPE_REFERENCE );
}
}

View file

@ -1,3 +1,8 @@
2004-05-14 Andrew Niefer
fix bug 62344, change completionOnTypeReference to lookup with empty prefix if
we have a context.
* src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionEngine.java
2004-05-13 Alain Magloire
Fix for PR 62064

View file

@ -528,8 +528,10 @@ public class CompletionEngine implements RelevanceConstants {
// completing on a type
// 1. Get the search scope node
IASTScope searchNode = completionNode.getCompletionScope();
// if the prefix is not empty
if(completionNode.getCompletionPrefix().length() > 0 ) {
// if the prefix is not empty, or we have a context
if(completionNode.getCompletionPrefix().length() > 0 ||
completionNode.getCompletionContext() != null )
{
// 2. Lookup all types that could be used here
ILookupResult result;
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[4];