Newcomer to Clangd

Hello, everyone:

I've recently come across the Clangd project, a server implementation of the Language Server Protocol that looks very promising to ensure the C++ family of languages have great support no matter the tools you use to develop.

I'm willing to contribute to this program. As I read at clang-tools-extra/clangd.rst at master · llvm-mirror/clang-tools-extra · GitHub, basic formatting, code completion and fix-its are apparently already working. Is there any bug tracker so that I can start working on small bug fixes?

Also, I would like to test this with other clients with LSP support outside of VS Code. I'd like to add/test proper Emacs support for this tool.

Thank you very much and I hope I start contributing soon!

Daniel Martín

FYI for Emacs support you might start by looking at irony-mode:

https://github.com/Sarcasm/irony-mode

This creates a small server linked with libclang that an Emacs mode can
use to request source interpretation, to enable code completion and
syntax checking.

It works pretty well, although sometimes it gets stuck and I have to
kill/restart the irony server else trying to visit a buffer hangs.

Yes, I'm aware of irony-mode, YCM, Rtags, etc. The problem is that they are more or less constantly reinventing the wheel, and also use different protocol formats. The consequence of this is that you typically have to install RTags for cross references and irony/YCM for autocompletion. And after that, you might feel the necessity to create "just another tool" to make those components talk to each other and to the build system (see cmake-ide, for example). This clearly does not scale well and would not let us avoid clunky C++ support outside of major IDEs anytime soon.

I think Clangd, which is based on a well-documented protocol that is gaining traction across the industry, is the way to go.

Regards,

Daniel Martín

Sorry I wasn't clear: I in no way meant to discourage this effort. I
was just pointing to existing efforts that might serve as a base to
start with rather than starting from scratch... but it looks like you're
aware of them already so never mind!

Any improvement in Emacs support for C++ (in particular) programming is
extremely welcome!

As per https://bugs.llvm.org/show_bug.cgi?id=33135 it doesn’t look like there’s an official bug list.

A simple search at llvm bugzilla: https://bugs.llvm.org/buglist.cgi?quicksearch=clangd

An intro to llvm codebase: https://blog.regehr.org/archives/1453

An intro to llvm itself: http://www.aosabook.org/en/llvm.html

+a couple of people working on clangd

+krasimir, who has been working on adding clangd support to ycmd.

There’s currently no easy way to install clangd even into VSCode and no way to use clangd with vim/Emacs.
So it’s not surprising that we don’t have any bugs for it, there aren’t many users.
It would be really nice to have releases of clangd binary and plugins for major text editors.
So having an Emacs integration would be really great at that point.

The VSCode plugin is under http://llvm.org/svn/llvm-project/clang-tools-extra/trunk/clangd/clients/.

Putting your Emacs code there seems like a good idea.

Looking at the tests might be helpful to get started, they show exactly the input/expected output of running clangd:
http://llvm.org/svn/llvm-project/clang-tools-extra/trunk/test/clangd/

The whole functionality we already have is covered there. (One major missing feature is ‘goto declaration/definition’.)

If you need any help in setting up/compiling clangd, or if you have any questions about the code, let us know.

I suppose this project:

https://github.com/emacs-lsp

much more relevant for clangd, that uses Language Server Protocol.