I use nvim with coc and clangd as the language server on a ubuntu 22.04 machine. I mainly use it to code in c++ when I code.
What I want is to automatically generate doxygen style comments to describe classes, functions and such. The preferred way is to automatically generate the snippet when I type
/** in insert mode and it should be context sensitive (as in automatically get the parameter names), like visual studio does for C#.
In short, I want
- Integration with code completion, showing the description of stuff as it suggests the completion as it does with the standard library. At the moment, coc just dumps the comment above the function and isn't really smart about filtering things based on the cursor position and such. For example it describes what std::string is like so, and I would like that same feature for my own types and functions:
Code completion for the documentation comments, such as @pa should complete to @param and then complete parameter names, preferably already suggesting the next one.
Automatically generate the correct snippet when I type
///<CR>in insert mode, even if there is stuff like template and/or requires in front of a function name.
Integrate with the language server so that rename causes the doxygen references to that same identifier to also be renamed. For example renaming a parameter should automatically also rename the doxygen comment parameter name.
I had hoped that such a thing would be integrated with clangd's completer, but I looked here and didn't find anything. So I searched for a vim plugin, but the only thing I could find was
this 13 year old script.
But that doesn't seem to work with Plug. Or maybe it does? It doesn't have any installation instructions besides putting it into ~/.vim/plugin, and I'm not sure that works anyway. And it doesn't seem automated at all or offer any of the features I want, particularly the autocomplete hints.
I tried installing it with Plug, then I found out that it doesn't update the comment but rather just creates a new one whenever the command is invoked.
I also found this 9 years old question on SO. But I'd really rather just install some plugins and configure it rather than spending another day writing snippets that I don't know the syntax of. On top of that they will also not update the comments, parameter names, etc.
None of those things provide some sort of integration with the clang language server, where I would get those comments shown as I type for example a function call or get the function name completion in coc. They would also not be renamed if I used the rename refactoring offered by coc through clang.
All of those features are available in many gui applications like visual studio, code lite and even the ancient and discontinued code blocks editor. Sublime Text has the DoxyDoxygen plugin. How do I get that in nvim?