[PATCH] D107365: clangd: Make documentation property of completion items more similar
Christian Kandeler via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 6 07:29:29 PDT 2021
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));
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107365.364790.patch
Type: text/x-patch
Size: 1600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210806/e8bf4e96/attachment-0001.bin>
More information about the cfe-commits
mailing list