Skip to content

Language Server Protocol

What is Language Server?

From the Language Server web site: The Language Server Protocol (LSP) is used between the IDE and a language smartness provider (the server) to integrate features like auto complete, go to definition, find all references and alike into the tool

Install Language Servers

Below you may find the installation instructions for the most common Language Servers, select the ones you are interested in and then configure them in CodeLite

clangd is the LSP implementation from the clang for C/C++/Objective-C team. It provide a compiler level completion with an unmatched accuracy. Visit the project home page


On Windows, CodeLite comes with a pre built binary of clangd configured and installed.


On Linux machines, you will need to manually install clangd via your package manager. On Ubuntu and Debian it is usually part of the clang-tools package. So to install it, use the below code snippet:

sudo apt-get update
sudo apt-get install clang-tools

Once installed, follow the steps in the manual configuration section


Often, the clang-tools package comes with a version number, e.g. clang-tools-10 Make sure to install the one with the highest number


Like Windows, clangd in part of CodeLite bundle

ctagsd is CodeLite's builtin code completion engine for C/C++ that implements the Language Server Protocol. ctagsd is installed along with CodeLite on all platforms.

CodeLite configures ctagsd for you, but it is disabled by default. To enable it:


pylsps is installed via pip. For this, you will need to install the following:

  • python 3 installed
  • pip3 installed
pip install python-lsp-server

On Windows / MSYS2, use this command:

pacman -S mingw-w64-x86_64-python mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-ujson
pip install python-lsp-server

Visit the project home page

  • Install node
  • Type:
npm install -g typescript typescript-language-server

If you choose to configure it manually in CodeLite, use this as the command:

typescript-language-server --stdio

rust-analyzer is the recommended LSP for the rust language. To install it, follow these steps:

  • Install rust
  • Open a terminal and type:
    • On macOS and Linux:
      rustup update
      rustup +nightly component add rust-src rust-analyzer-preview
    • On Windows:
      %USERPROFILE%\.cargo\bin\rustup update
      %USERPROFILE%\.cargo\bin\rustup +nightly component add rust-src rust-analyzer-preview

You should now have rust-analyzer installed under rustup local folder, for example, under Linux or macOS, it can be found here:

TARGET=$(rustup target list|grep installed|cut -d" " -f1)

rls is yet another rust language server, but less popular than rust-analzyer

To install it:

  • Install rust
  • Open a terminal and type:
    • On macOS and Linux:
      rustup update
      rustup component add rls rust-analysis rust-src
    • On Windows:
      %USERPROFILE%\.cargo\bin\rustup update
      %USERPROFILE%\.cargo\bin\rustup component add rls rust-analysis rust-src
      Visit the project home page


The rls language server must be started from the cargo project directory i.e. the location of the Cargo.toml file

Automatic detection

Once you have installed your favourite Language Servers, its time to tell CodeLite about it:

  • Goto PluginsLanguage ServerSettings
  • Click on the Scan button

Manual configuration

The above instructions are for the most common language servers. However, you can install and configure any server the follows the LSP protocol. You will however, need to do this manually:

  • Install the LSP you want on your computer. You can visit this site to get a complete list of all LSP implementations out there
  • From the main menu, PluginsLanguage ServerSettings...
  • Click on the Add button
  • In the dialog that opens, fill the mandatory fields:
Field Mandatory Description
Enabled Is this LSP enabled?
Name Provide a descriptive name for this LSP
Remote server - When enabled, the Command is executed on a remote machine
Command The LSP execution command. For example, for clangd, the command can be as simple as /usr/bin/clangd
Working directory - Path to set before running the command
Languages Since CodeLite can have multiple LSP configured, you can associate each LSP with a language. CodeLite will use the proper LSP based on the current file's language. Use the ... button to see a list of supported languages
Connection string Defines the protocol that CodeLite communicates with the LSP. Most of the LSP servers out there supporting the stdio protocol
Priority Defines this LSP priority compared to other LSPs for the same language, the higher the better
Display diagnostics - When checked, CodeLite will display little red arrows next to potential code errors

Resolving conflicts - using the priority property

User can configure multiple language servers for the same coding language (e.g. ctagsd and clangd for C++) In order to decide which language server to use first, CodeLite uses the Priority property of the language server. The server with the highest value is used first

CMake clangd / ctagsd

compile_flags.txt & compile_commands.json

clangd and ctagsd uses these two files as instructions for how to build any source file. clangd and ctagsd will searche for these files from the active file folder and going up to the parent until it finds a match (or it can't go up any more) In case both files are found on the same directory, compile_flags.txt takes precedence.

When using CodeLite's default C++ workspace CodeLite generate these files for your automatically once the build process is completed

However, when using other workspaces (e.g. the File System Workspace) you need to provide these files (at least one of them) in order for clangd code completion to function.

If you are using cmake as your build system, you can add these two commands in the top level CMakeLists.txt file:

  • At the top of your CMakeLists.txt add this line:
  • and somewhere at the bottom of the top level CMakeLists.txt file, add this command:
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json

this way, after running cmake, you will get an up-to-date compile_commands.json file for clangd