1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +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 b1d6194e14
commit 9e60a646fd
2 changed files with 15 additions and 2 deletions

View file

@ -1481,7 +1481,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

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