Index: clangd/XRefs.cpp =================================================================== --- clangd/XRefs.cpp +++ clangd/XRefs.cpp @@ -39,7 +39,8 @@ if (const auto *FD = dyn_cast(D)) return FD->getDefinition(); // Only a single declaration is allowed. - if (isa(D)) // except cases above + if (isa(D) || isa(D) || + isa(D)) // except cases above return D; // Multiple definitions are allowed. return nullptr; // except cases above @@ -243,6 +244,7 @@ index::IndexingOptions::SystemSymbolFilterKind::All; IndexOpts.IndexFunctionLocals = true; IndexOpts.IndexParametersInDeclarations = true; + IndexOpts.IndexTemplateParameters = true; indexTopLevelDecls(AST.getASTContext(), AST.getPreprocessor(), AST.getLocalTopLevelDecls(), DeclMacrosFinder, IndexOpts); @@ -441,6 +443,7 @@ index::IndexingOptions::SystemSymbolFilterKind::All; IndexOpts.IndexFunctionLocals = true; IndexOpts.IndexParametersInDeclarations = true; + IndexOpts.IndexTemplateParameters = true; indexTopLevelDecls(AST.getASTContext(), AST.getPreprocessor(), AST.getLocalTopLevelDecls(), RefFinder, IndexOpts); return std::move(RefFinder).take(); Index: unittests/clangd/SymbolInfoTests.cpp =================================================================== --- unittests/clangd/SymbolInfoTests.cpp +++ unittests/clangd/SymbolInfoTests.cpp @@ -213,14 +213,14 @@ T^T t; }; )cpp", - {/* not implemented */}}, + {CreateExpectedSymbolDetails("TT", "bar::", "c:TestTU.cpp@65")}}, { R"cpp( // Template parameter reference - type param template struct bar { int a = N^N; }; )cpp", - {/* not implemented */}}, + {CreateExpectedSymbolDetails("NN", "bar::", "c:TestTU.cpp@65")}}, { R"cpp( // Class member reference - objec struct foo { Index: unittests/clangd/XRefsTests.cpp =================================================================== --- unittests/clangd/XRefsTests.cpp +++ unittests/clangd/XRefsTests.cpp @@ -285,11 +285,15 @@ } )cpp", - /* FIXME: clangIndex doesn't handle template type parameters R"cpp(// Template type parameter - template <[[typename T]]> + template void foo() { ^T t; } - )cpp", */ + )cpp", + + R"cpp(// Template template type parameter + template class [[T]]> + void foo() { ^T t; } + )cpp", R"cpp(// Namespace namespace $decl[[ns]] {