Emacs setup for C++- 2 mins
Adding features like auto complete, go to definition, or documentation on hover for a programming language takes significant effort. Traditionally this work had to be repeated for each development tool, as each tool provides different APIs for implementing the same feature. A Language Server is meant to provide the language-specific smarts and communicate with development tools over a protocol that enables inter-process communication. The idea behind the Language Server Protocol (LSP) is to standardize the protocol for how such servers and development tools communicate. This way, a single Language Server can be re-used in multiple development tools, which in turn can support multiple languages with minimal effort.
ccls is a stand-alone server implementing the Language Server Protocol for C, C++, and Objective-C languages.
At the end of the process, you should have ccls in your path. If you don’t want to install or cannot install ccls, just remember the path to the release binary that you get after the build process.
Then we can setup ccls. It uses flymake for its syntax checking. We can disable that to let flycheck do its thing.
That is it. When you open a new c++ file, ccls should ask you for the root of the project and make sense of how your project is structured more or less on its own. You can also configure a project to help ccls by following the instructions here.