diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -296,6 +296,18 @@ return true; } + bool TraverseTemplateArgumentLoc(TemplateArgumentLoc L) { + switch (L.getArgument().getKind()) { + case TemplateArgument::Template: + case TemplateArgument::TemplateExpansion: + H.addToken(L.getTemplateNameLoc(), HighlightingKind::DependentType); + break; + default: + break; + } + return RecursiveASTVisitor::TraverseTemplateArgumentLoc(L); + } + // findExplicitReferences will walk nested-name-specifiers and // find anything that can be resolved to a Decl. However, non-leaf // components of nested-name-specifiers which are dependent names diff --git a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp --- a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -686,6 +686,14 @@ void $Function[[bar]]($TemplateParameter[[T]] $Parameter[[F]]) { $Parameter[[F]].$DependentName[[foo]](); } + )cpp", + // Dependent template name + R"cpp( + template