🕸️Language Server Protocol (LSP)
Also known as Language Server, LSP Server
A shared way for any code editor to get help with a language. One server serves all.
Think of it like
It is like a plug that fits each socket. One helper works in any editor.
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.
Why it matters
Before it, each editor had to build help for each language. Now each language is built once.
Definition
Example code
json
{"jsonrpc": "2.0", "id": 1, "method": "textDocument/definition",
"params": {"textDocument": {"uri": "file:///app.py"},
"position": {"line": 11, "character": 8}}}Common mistake
Key takeaways
- 1One server per language. Shared by every editor.
- 2Ask and answer. Editors send questions in JSON.
- 3Runs apart. The server is its own program.