Index: clangd/CodeComplete.cpp =================================================================== --- clangd/CodeComplete.cpp +++ clangd/CodeComplete.cpp @@ -349,6 +349,9 @@ } Completion.Kind = toCompletionItemKind( C.SemaResult->Kind, C.SemaResult->Declaration, ContextKind); + if (Completion.Kind == CompletionItemKind::File && + Completion.Name.back() == '/') + Completion.Kind = CompletionItemKind::Folder; for (const auto &FixIt : C.SemaResult->FixIts) { Completion.FixIts.push_back( toTextEdit(FixIt, ASTCtx.getSourceManager(), ASTCtx.getLangOpts())); Index: clangd/Protocol.h =================================================================== --- clangd/Protocol.h +++ clangd/Protocol.h @@ -704,6 +704,7 @@ Color = 16, File = 17, Reference = 18, + Folder = 19, }; /// Defines whether the insert text in a completion item should be interpreted Index: unittests/clangd/CodeCompleteTests.cpp =================================================================== --- unittests/clangd/CodeCompleteTests.cpp +++ unittests/clangd/CodeCompleteTests.cpp @@ -2073,6 +2073,27 @@ } } +TEST(CompletionTest, IncludedCompletionKinds) { + MockFSProvider FS; + MockCompilationDatabase CDB; + std::string Subdir = testPath("sub"); + std::string SearchDirArg = (llvm::Twine("-I") + Subdir).str(); + CDB.ExtraClangFlags = {SearchDirArg.c_str()}; + std::string BarHeader = testPath("sub/bar.h"); + FS.Files[BarHeader] = ""; + IgnoreDiagnostics DiagConsumer; + ClangdServer Server(CDB, FS, DiagConsumer, ClangdServer::optsForTest()); + auto Results = completions(Server, + R"cpp( + #include "^" + )cpp" + ); + EXPECT_THAT(Results.Completions, + AllOf(Has("sub/", CompletionItemKind::Folder), + Has("bar.h\"", CompletionItemKind::File))); +} + + } // namespace } // namespace clangd } // namespace clang