# Language Server Protocol (LSP)

> A shared way for any code editor to get help with a language. One server serves all.

**Field:** Software Development  
**Category:** Code Intelligence  
**Also known as:** Language Server, LSP Server

## Think of it like

It is like a plug that fits each socket. One helper works in any editor.

## Definition

The Language Server Protocol is a shared way for code editors to ask a helper program about a language. The helper is called a language server, and it runs on its own. The editor sends questions, such as where is this defined. The server sends answers. They talk in JSON, in a format called JSON-RPC. So one server for a language works in every editor that speaks LSP.

## Example

Emma's editor asks the Python server where a name on line 12 of app.py is defined. The answer is line 40 of utils.py.

## Example code

```json
{"jsonrpc": "2.0", "id": 1, "method": "textDocument/definition",
 "params": {"textDocument": {"uri": "file:///app.py"},
            "position": {"line": 11, "character": 8}}}
```

The editor asks where the name at line 12 is defined. Lines count from 0.

## Why it matters

Before it, each editor had to build help for each language. Now each language is built once.

## Common mistake

Blaming the editor when hints go wrong. The answers come from the language server, so that is what to update or fix.

## Three principles

- **One server per language.** Shared by every editor.
- **Ask and answer.** Editors send questions in JSON.
- **Runs apart.** The server is its own program.

## Related terms

- [Go to Definition](https://learn.benibix.com/term/development/go-to-definition)
- [Find All References](https://learn.benibix.com/term/development/find-all-references)
- [Autocomplete](https://learn.benibix.com/term/development/autocomplete)
- [Visual Studio Code](https://learn.benibix.com/term/development/visual-studio-code)
- [Code Intelligence](https://learn.benibix.com/term/development/code-intelligence)
- [LSP Tool](https://learn.benibix.com/term/ai/lsp-tool)

## Told apart from

- [Tree-sitter vs Language Server](https://learn.benibix.com/compare/tree-sitter-vs-language-server-protocol): People think Tree-sitter and a language server do the same job in an editor, and they do not. Tree-sitter reads the shape of one file, fast, and it is used to colour and fold code. A language server knows what names mean across the whole project. It powers go to definition, rename and error hints. Most editors use both, side by side.

![Three editors on the left, VS Code, Vim and another editor, all joined to one language server for Python on the right, lit up. Between them, a request labelled go to definition, file app.py, line 12, goes right, and an answer labelled utils.py, line 40, comes back. A note says one server serves every editor, so each language is built once.](https://learn.benibix.com/diagrams/dev4-lsp.svg)

---

Source: https://learn.benibix.com/term/development/language-server-protocol
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
