You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor LSP Documentation for Improved Clarity and Structure
The LSP documentation page has been reorganized to improve readability,
navigation, and consistency. The changes address user feedback about
difficulty finding installation steps and understanding configuration
requirements.
**Why:**
The previous documentation structure intermixed conceptual information
with installation instructions, making it difficult for users to quickly
find the specific language server setup they needed. The inconsistent
formatting and lack of clear section hierarchy also contributed to
confusion during the configuration process.
**What changed:**
* Restructured the entire page with a clearer hierarchy using proper
Markdown heading levels
* Expanded the overview section to better explain LSP concepts and
provide context before diving into technical details
* Reorganized language server installation instructions into dedicated
subsections with consistent formatting
* Improved installation steps with clearer platform-specific instructions
and prerequisite requirements
* Enhanced the configuration section with better-formatted tables and
step-by-step procedures
* Clarified CMake integration documentation with distinct options for
different scenarios
* Standardized terminology and wording throughout the document for
consistency
* Improved code block formatting and command examples for better
copy-paste experience
The content remains functionally equivalent but is now significantly
easier to navigate and understand.
* Documentation structure and formatting
* Installation instructions for clangd, ctagsd, pylsp, TypeScript,
rust-analyzer, and gopls
* Configuration guidance (automatic and manual)
* CMake integration examples
** Generated by CodeLite. **
Signed-off-by: Eran Ifrah <eran@codelite.org>
From the [Language Server web site][1]: 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 allreferences and alike into the tool
5
+
The Language Server Protocol (LSP) is a standardized protocol used between development environments and language intelligence providers. It enables the integration of advanced features such as auto-completion, go-to-definition, and find-all-references directly into your development tool. For more information, visit the [Language Server Protocol website][1].
5
6
6
-
## Install Language Servers
7
7
---
8
8
9
-
Below you may find the installation instructions for the most common Language Servers,
10
-
select the ones you are interested in and then [configure them in CodeLite][14]
9
+
## Installing Language Servers
11
10
12
-
=== "clangd"
13
-
`clangd` is the LSP implementation from the `clang` for `C/C++/Objective-C` team. It provide a compiler level completion with an unmatched accuracy.
14
-
Visit the [project home page][7]
11
+
The following sections provide installation instructions for the most commonly used language servers. After installing your desired language servers, proceed to [configure them in CodeLite](#automatic-detection).
15
12
16
-
**All**
13
+
### clangd (C/C++/Objective-C)
17
14
18
-
`clangd` relies on a file named `compile_commands.json` or `compile_flags.txt`. When using CodeLite default C++ workspace
19
-
CodeLite can generate this file for the current workspace:
15
+
`clangd` is the official Language Server Protocol implementation from the Clang team, providing compiler-level code completion with exceptional accuracy for C, C++, and Objective-C. Visit the [clangd project page][4] for more information.
20
16
21
-
1. From the menu bar: `Settings` → `Code Completion ...`
22
-
2. Select the option `Generate compile_commands.json file`
23
-
3. Build your project
17
+
#### Prerequisites
24
18
25
-
**Windows**
19
+
`clangd` requires either a `compile_commands.json` or `compile_flags.txt` file to function. When using CodeLite's default C++ workspace, CodeLite can automatically generate this file:
26
20
27
-
Install `clangd` by install the recommended packages as [described here][15]
21
+
1. Navigate to **Settings → Code Completion** from the menu bar
22
+
2. Enable the **Generate compile_commands.json file** option
23
+
3. Build your project
28
24
29
-
**Linux**
25
+
#### Installation by Platform
30
26
31
-
On Linux machines, you will need to manually install `clangd` via your package manager.
32
-
On `Ubuntu` and `Debian` it is usually part of the `clang-tools` package. So to install it, use the below code snippet:
27
+
**Windows**
33
28
34
-
```bash
35
-
sudo apt-get update
36
-
sudo apt-get install clang-tools
37
-
```
29
+
Install `clangd` by installing the recommended packages as [described in the documentation][15].
38
30
39
-
Once installed, follow the steps in the [manual configuration section](#manual-configuration)
31
+
**Linux**
40
32
41
-
!!! Note
42
-
Often, the `clang-tools` package comes with a version number, e.g. `clang-tools-10`
43
-
Make sure to install the one with the highest number
33
+
Install `clangd` manually using your distribution's package manager. On Ubuntu and Debian, it is typically part of the `clang-tools` package:
44
34
45
-
**macOS**
35
+
```bash
36
+
sudo apt-get update
37
+
sudo apt-get install clang-tools
38
+
```
46
39
47
-
On macOS, `clangd` is provided as part of the `llvm` formula. To install it (via `brew`):
40
+
After installation, proceed to the [manual configuration section](#manual-configuration).
48
41
49
-
```bash
50
-
brew install llvm
51
-
```
42
+
!!! Note
43
+
The `clang-tools` package often includes a version number (e.g., `clang-tools-10`). Install the package with the highest available version number.
52
44
53
-
on ARM based macOS, `clangd` is placed under: `/opt/homebrew/opt/llvm/bin/clangd`
45
+
**macOS**
54
46
47
+
On macOS, `clangd` is provided as part of the `llvm` formula. Install it using Homebrew:
55
48
56
-
=== "ctagsd"
57
-
`ctagsd` is CodeLite's builtin code completion engine for `C/C++` that implements the Language Server Protocol.
58
-
`ctagsd` is installed along with CodeLite on all platforms.
49
+
```bash
50
+
brew install llvm
51
+
```
59
52
60
-
CodeLite configures `ctagsd` for you, but it is disabled by default. To enable it:
53
+
On ARM-based macOS systems, `clangd`is located at: `/opt/homebrew/opt/llvm/bin/clangd`
61
54
62
-
`Plugins` → `Settings` → `ctagsd`
55
+
### ctagsd (C/C++)
63
56
64
-
=== "pylsp"
65
-
`pylsps` is installed via `pip`. For this, you will need to install the following:
57
+
`ctagsd` is CodeLite's built-in code completion engine for C/C++ that implements the Language Server Protocol. It is automatically installed with CodeLite on all platforms.
66
58
67
-
- python 3 installed
68
-
- pip3 installed
59
+
CodeLite pre-configures `ctagsd`, but it is disabled by default. To enable it:
`gopls` (pronounced "Go Please") is the official Language Server Protocol implementation for Go.
137
+
138
+
**Installation**
139
+
140
+
```bash
141
+
go install golang.org/x/tools/gopls@latest
142
+
```
142
143
143
-
The above instructions are for the most common language servers. However, you can install
144
-
and configure any server the follows the LSP protocol. You will however, need to do this manually:
145
-
146
-
- Install the LSP you want on your computer. You can [visit this site][2] to get a complete list of all LSP implementations out there
147
-
- From the main menu, `Plugins`→`Language Server`→`Settings...`
148
-
- Click on the `Add` button
149
-
- In the dialogue that opens, fill the mandatory fields:
150
-
151
-
Field | Mandatory | Description
152
-
--------|-----------|-------------
153
-
Enabled | ✓ | Is this LSP enabled?
154
-
Name | ✓ | Provide a descriptive name for this LSP
155
-
Remote server| - | When enabled, the `Command` is executed on a remote machine
156
-
Command | ✓ | The LSP execution command. For example, for `clangd`, the command can be as simple as `/usr/bin/clangd`
157
-
Working directory | - | Path to set before running the command
158
-
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
159
-
Connection string| ✓ | Defines the protocol that CodeLite communicates with the LSP. Most of the LSP servers out there supporting the `stdio` protocol
160
-
Display diagnostics | - | When checked, CodeLite will display little red arrows next to potential code errors
161
-
162
-
## Resolving conflicts
163
144
---
164
145
165
-
It is allowed to configure multiple language servers for the same coding language (e.g. `ctagsd` and `clangd` for `C++`).
166
-
But make sure you only have one enabled at at time
146
+
## Configuration
147
+
148
+
### Automatic Detection
149
+
150
+
After installing your preferred language servers, configure CodeLite to detect them automatically:
151
+
152
+
1. Navigate to **Plugins → Language Server → Settings**
153
+
2. Click the **Scan** button
167
154
155
+
### Manual Configuration
156
+
157
+
You can install and configure any language server that implements the LSP protocol. For a complete list of available LSP implementations, visit [this resource][2].
158
+
159
+
**Configuration Steps**
160
+
161
+
1. Install the desired LSP on your system
162
+
2. Navigate to **Plugins → Language Server → Settings**
163
+
3. Click the **Add** button
164
+
4. Fill in the required fields in the dialog:
165
+
166
+
| Field | Mandatory | Description |
167
+
|-------|-----------|-------------|
168
+
| Enabled | ✓ | Enable or disable this LSP |
169
+
| Name | ✓ | Provide a descriptive name for this LSP |
170
+
| Remote server | - | When enabled, the command is executed on a remote machine |
171
+
| Command | ✓ | The LSP execution command (e.g., `/usr/bin/clangd` for clangd) |
172
+
| Working directory | - | Path to set before running the command |
173
+
| Languages | ✓ | Associate this LSP with specific languages. Use the `...` button to view supported languages |
174
+
| Connection string | ✓ | Protocol used for communication (most LSP servers support `stdio`) |
175
+
| Display diagnostics | - | When checked, CodeLite displays error indicators in the editor |
176
+
177
+
### Resolving Conflicts
178
+
179
+
Multiple language servers can be configured for the same programming language (e.g., both `ctagsd` and `clangd` for C++). However, ensure that only one is enabled at a time to avoid conflicts.
168
180
169
-
## CMake `clangd` / `ctagsd`
170
181
---
171
182
172
-
### `compile_flags.txt` & `compile_commands.json`
183
+
##CMake Integration
173
184
174
-
`clangd` and `ctagsd` are using these two files as instructions for "how to build" any source file.
175
-
`clangd` and `ctagsd` will search 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)
185
+
### Using clangd and ctagsd with CMake
176
186
177
-
In case both files are found on the same directory, `compile_flags.txt` takes precedence.
187
+
Both `clangd` and `ctagsd` rely on `compile_flags.txt` or `compile_commands.json`files for build instructions. These language servers search for these files starting from the active file's directory and traversing up the parent directories until a match is found.
178
188
179
-
When using CodeLite's [default C++ workspace](../workspaces/default.md) CodeLite generate these files for your automatically once the build process is completed
189
+
If both files exist in the same directory, `compile_flags.txt` takes precedence.
180
190
181
-
However, when using other workspaces (e.g. the [File System Workspace](../workspaces/file_system.md)) you need to provide these files (at least one of them) in order for `clangd` code completion to function.
191
+
**CodeLite Default C++ Workspace**
182
192
183
-
If you are using `cmake` as your build system, you can add these two commands in the top level `CMakeLists.txt` file:
193
+
When using CodeLite's [default C++ workspace](../workspaces/default.md), these files are generated automatically after the build process completes.
184
194
185
-
- At the top of your `CMakeLists.txt` add this line:
195
+
**Other Workspace Types**
186
196
187
-
```cmake
188
-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
189
-
```
197
+
When using other workspace types (e.g., [File System Workspace](../workspaces/file_system.md)), you must provide at least one of these files manually for `clangd` code completion to function.
190
198
191
-
- Or alternatively, you can pass this variable as part of `CMake` invocation line:
After running CMake, an up-to-date `compile_commands.json` file will be generated for `clangd`.
209
227
210
-
Use the `cc-wrapper` utility that comes with CodeLite - [see the docs here][16]
228
+
### Generating compile_commands.json for Makefile Projects
229
+
230
+
For traditional Makefile-based projects, use the `cc-wrapper` utility included with CodeLite. Refer to the [cc-wrapper documentation][16] for detailed instructions.
0 commit comments