diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java index 11770af7ffd..3eea0fee200 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,10 +30,6 @@ import org.eclipse.jface.text.Position; import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.swt.graphics.RGB; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMManager; import org.eclipse.cdt.core.dom.ast.IASTComment; @@ -55,9 +51,13 @@ import org.eclipse.cdt.ui.testplugin.ResourceTestHelper; import org.eclipse.cdt.internal.ui.editor.CEditor; import org.eclipse.cdt.internal.ui.editor.SemanticHighlighting; import org.eclipse.cdt.internal.ui.editor.SemanticHighlightingManager; +import org.eclipse.cdt.internal.ui.editor.SemanticHighlightingManager.HighlightedPosition; import org.eclipse.cdt.internal.ui.editor.SemanticHighlightingPresenter; import org.eclipse.cdt.internal.ui.editor.SemanticHighlightings; -import org.eclipse.cdt.internal.ui.editor.SemanticHighlightingManager.HighlightedPosition; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; /** * Semantic highlighting tests. @@ -445,6 +445,21 @@ public class SemanticHighlightingTest extends TestCase { // Duration operator "" _d(unsigned long long); //$class,functionDeclaration // Duration dur = 1000_d; //$class,globalVariable,overloadedOperator public void testUserDefinedLiteralSuffix_484617() throws Exception { + makeAssertions(); + } + + // template //$templateParameter,templateParameter + // struct Pair {}; //$class + // + // template //$templateParameter + // using PairIntX = Pair; //$typedef,class,templateParameter + // + // struct Waldo {}; //$class + // + // int main() { //$functionDeclaration + // PairIntX pair; //$typedef,class,localVariableDeclaration + // } + public void testAliasTemplates_416748() throws Exception { makeAssertions(); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java index 597c95b795a..43131ab1ca9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -51,6 +51,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNameSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVirtSpecifier; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplateInstance; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredFunction; @@ -1142,6 +1144,18 @@ public class SemanticHighlightings { return false; } IBinding binding= token.getBinding(); + // Names that resolve to alias template instances are template-ids + // with the template-name naming the alias template. We don't want + // to color the entire template-id, but rather want to color its + // constituent names separately. + if (binding instanceof ICPPAliasTemplateInstance) { + return false; + } + // This covers the name defining an alias template. + if (binding instanceof ICPPAliasTemplate) { + return true; + } + // This covers regular typedefs. if (binding instanceof ITypedef) { return true; }