[clang-tools-extra] [clangd] Doxygen Parsing: Add proper handling of \note, \warning and \retval command + change render kind of command arguments + add preprocessing for markdown code blocks/spans (PR #156365)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 15 05:28:45 PDT 2025


tcottin wrote:

> It's working great as intended! <img alt="image" width="295" height="455" src="https://private-user-images.githubusercontent.com/54050160/484637944-77662462-d9f8-47b8-8c7f-1ae909078ee4.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTc5Mzg3NTIsIm5iZiI6MTc1NzkzODQ1MiwicGF0aCI6Ii81NDA1MDE2MC80ODQ2Mzc5NDQtNzc2NjI0NjItZDlmOC00N2I4LThjN2YtMWFlOTA5MDc4ZWU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA5MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwOTE1VDEyMTQxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdjMWVlNzBkMmIxMTAwNzMwMTQ1Yzk2ODQwYjFhYTc2YmNjYzk5ZjEzMTY3NGNiN2ZjOTU5OTVkNDEyNjY1ZTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.eg2AVd1re94549MBMLaPMthkoMdkJ6MgNoDm0e0UMTc"> Can other commands like `@details` be added the same way we add paragraphs for `@note` and `@warning`?
> 
> Update: Yes we can, just add some more changes as given below. This should work well for "generic" ones that only needs a _Header_ and its content to be shown. Compiled and tested it out, working quite well.
> 
> ```diff
> diff --git a/clang-tools-extra/clangd/SymbolDocumentation.cpp b/clang-tools-extra/clangd/SymbolDocumentation.cpp
> index 86bd6162b..1638e4b55 100644
> --- a/clang-tools-extra/clangd/SymbolDocumentation.cpp
> +++ b/clang-tools-extra/clangd/SymbolDocumentation.cpp
> @@ -216,6 +216,7 @@ public:
>        break;
>      case comments::CommandTraits::KCI_note:
>      case comments::CommandTraits::KCI_warning:
> +    case comments::CommandTraits::KCI_details:
>        commandToHeadedParagraph(B);
>        break;
>      case comments::CommandTraits::KCI_retval: {
> ```

I am not sure if `@details` should get a header like this.
Doxygen just omits this command:

```cpp
/// @brief a sample function
/// @note test note for myFunction
/// @details detailed description of myFunction
void myFunction();
```

<img width="264" height="248" alt="grafik" src="https://github.com/user-attachments/assets/51cd0c62-542c-410e-9115-7fef43f60e53" />


https://github.com/llvm/llvm-project/pull/156365


More information about the cfe-commits mailing list