1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 509182 - Completion of class type in using-declaration

Change-Id: Iacd0ab4bfead2df31cddc78840853eb697139b02
This commit is contained in:
Nathan Ridge 2017-01-11 01:13:56 -05:00
parent d02a030f03
commit 0a23da7e56
2 changed files with 15 additions and 2 deletions

View file

@ -1444,7 +1444,16 @@ public class CompletionTests extends AbstractContentAssistTest {
final String[] expected= { "foo;" };
assertCompletionResults(fCursorOffset, expected, REPLACEMENT);
}
// namespace N {
// class waldo {};
// }
// using N::w/*cursor*/
public void testUsingDeclaration_509182() throws Exception {
final String[] expected = { "waldo;" };
assertCompletionResults(fCursorOffset, expected, REPLACEMENT);
}
// template <typen/*cursor*/
public void testTemplateDeclaration_397288() throws Exception {
final String[] expected= { "typename" };

View file

@ -476,7 +476,11 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
getImage(classType), baseRelevance + relevance, context));
}
}
proposals.add(createProposal(classType.getName(), classType.getName(), getImage(classType),
StringBuilder repStringBuff = new StringBuilder(classType.getName());
if (context.isInUsingDirective() && !context.isFollowedBySemicolon()) {
repStringBuff.append(';');
}
proposals.add(createProposal(repStringBuff.toString(), classType.getName(), getImage(classType),
baseRelevance + RelevanceConstants.CLASS_TYPE_RELEVANCE, context));
}
}