[PATCH] D107365: clangd: Make documentation property of completion items more similar
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG6b28835b3754: clangd: Make documentation property of completion items more similar (authored by ckandeler, committed by sammccall). Changed prior to commit: https://reviews.llvm.org/D107365?vs=364790=366128#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107365/new/ https://reviews.llvm.org/D107365 Files: clang-tools-extra/clangd/CodeComplete.cpp clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp === --- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -907,7 +907,7 @@ auto Results = completions( R"cpp( // Non-doxygen comment. - int foo(); + __attribute__((annotate("custom_annotation"))) int foo(); /// Doxygen comment. /// \param int a int bar(int a); @@ -919,7 +919,8 @@ int x = ^ )cpp"); EXPECT_THAT(Results.Completions, - Contains(AllOf(Named("foo"), Doc("Non-doxygen comment."; + Contains(AllOf(Named("foo"), + Doc("Annotation: custom_annotation\nNon-doxygen comment."; EXPECT_THAT( Results.Completions, Contains(AllOf(Named("bar"), Doc("Doxygen comment.\n\\param int a"; Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -403,8 +403,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto DocComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, DocComment)); } } if (Completion.Deprecated) { Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp === --- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -907,7 +907,7 @@ auto Results = completions( R"cpp( // Non-doxygen comment. - int foo(); + __attribute__((annotate("custom_annotation"))) int foo(); /// Doxygen comment. /// \param int a int bar(int a); @@ -919,7 +919,8 @@ int x = ^ )cpp"); EXPECT_THAT(Results.Completions, - Contains(AllOf(Named("foo"), Doc("Non-doxygen comment."; + Contains(AllOf(Named("foo"), + Doc("Annotation: custom_annotation\nNon-doxygen comment."; EXPECT_THAT( Results.Completions, Contains(AllOf(Named("bar"), Doc("Doxygen comment.\n\\param int a"; Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -403,8 +403,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto DocComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, DocComment)); } } if (Completion.Deprecated) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107365: clangd: Make documentation property of completion items more similar
ckandeler updated this revision to Diff 364790. ckandeler added a comment. Added test coverage. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107365/new/ https://reviews.llvm.org/D107365 Files: clang-tools-extra/clangd/CodeComplete.cpp clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp === --- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -907,7 +907,7 @@ auto Results = completions( R"cpp( // Non-doxygen comment. - int foo(); + __attribute__((annotate("custom_annotation"))) int foo(); /// Doxygen comment. /// \param int a int bar(int a); @@ -919,7 +919,8 @@ int x = ^ )cpp"); EXPECT_THAT(Results.Completions, - Contains(AllOf(Named("foo"), Doc("Non-doxygen comment."; + Contains(AllOf(Named("foo"), + Doc("Annotation: custom_annotation\nNon-doxygen comment."; EXPECT_THAT( Results.Completions, Contains(AllOf(Named("bar"), Doc("Doxygen comment.\n\\param int a"; Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -405,8 +405,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto DocComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, DocComment)); } } } Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp === --- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -907,7 +907,7 @@ auto Results = completions( R"cpp( // Non-doxygen comment. - int foo(); + __attribute__((annotate("custom_annotation"))) int foo(); /// Doxygen comment. /// \param int a int bar(int a); @@ -919,7 +919,8 @@ int x = ^ )cpp"); EXPECT_THAT(Results.Completions, - Contains(AllOf(Named("foo"), Doc("Non-doxygen comment."; + Contains(AllOf(Named("foo"), + Doc("Annotation: custom_annotation\nNon-doxygen comment."; EXPECT_THAT( Results.Completions, Contains(AllOf(Named("bar"), Doc("Doxygen comment.\n\\param int a"; Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -405,8 +405,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto DocComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, DocComment)); } } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107365: clangd: Make documentation property of completion items more similar
sammccall accepted this revision. sammccall added a comment. This revision is now accepted and ready to land. LG but could you please add a test showing this difference? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107365/new/ https://reviews.llvm.org/D107365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107365: clangd: Make documentation property of completion items more similar
ckandeler updated this revision to Diff 364412. ckandeler added a comment. Addressed lint complaints. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107365/new/ https://reviews.llvm.org/D107365 Files: clang-tools-extra/clangd/CodeComplete.cpp Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -405,8 +405,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto DocComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, DocComment)); } } } Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -405,8 +405,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto DocComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, DocComment)); } } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107365: clangd: Make documentation property of completion items more similar
ckandeler created this revision. ckandeler added a reviewer: sammccall. Herald added subscribers: usaxena95, kadircet, arphaman. ckandeler requested review of this revision. Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov. Herald added a project: clang-tools-extra. ... to the one of signature hints. In particular, completion items now also carry annotations, which client code might be interested in. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D107365 Files: clang-tools-extra/clangd/CodeComplete.cpp Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -405,8 +405,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto docComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, docComment)); } } } Index: clang-tools-extra/clangd/CodeComplete.cpp === --- clang-tools-extra/clangd/CodeComplete.cpp +++ clang-tools-extra/clangd/CodeComplete.cpp @@ -405,8 +405,9 @@ if (C.IndexResult) { SetDoc(C.IndexResult->Documentation); } else if (C.SemaResult) { -SetDoc(getDocComment(*ASTCtx, *C.SemaResult, - /*CommentsFromHeader=*/false)); +const auto docComment = getDocComment(*ASTCtx, *C.SemaResult, + /*CommentsFromHeader=*/false); +SetDoc(formatDocumentation(*SemaCCS, docComment)); } } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits