I’ve been using vscode ever since I started coding. Since cpp is my main programming language, someone recommended clion for me. After a few months of experience, I found the code completion of clion is awesome. However, I prefer the old-schooled way of compiling and debugging (by that I mean command-line make & gdb) and many features provided by clion as an IDE are useless to me. Besides, my laptop got really hot when running clion. To me, clion is too “heavy” to be a code editor.
It seems that I am currently seeking something between a code editor and IDE. Then I came across clangd and the concept of LSP. I think this could be the solution to my problem. However, after a few shots I found that the code completion feature of clangd is not that good. For example, when I type ClassName::funcn, logically it should complete the whole signature of the function cause clearly I am writing the definition of the member function instead of calling it (or, more specificly, it could decide between completing the function name or the whole signature by judging whether funcn correspond to a static function, or if where I am typing is within a block or in the global field) To make matter worse, I found there are very limited configuration options for clangd users.
So is it possible that clangd allow users to develop based on clangd itself (rather than its source code) through something like plugins or api?
No, clangd does not have its own plugin API. I don’t think one would be useful for things like customizing code completion behaviour in the ways you describe, because the analysis required to answer questions like “is this function a static function” requires access to clang’s AST API; I don’t really think that can be made meaningfully simpler than just modifying clangd’s source.
We do welcome contributions to clangd to improve behaviours like this, as well as issues filed to track suggested improvements. Some issues already on file which are similar to what you describe (but not the exact same scenario) are clangd should not add function parameter placeholders for `std::endl` · Issue #439 · clangd/clangd · GitHub and Completion of pointers to functions and function objects · Issue #968 · clangd/clangd · GitHub.