Editor knows syntax but not project types — what provides hover, go-to-definition across files?
Per Wikipedia: “An LSP server is a process that implements Language Server Protocol to analyze workspace files and answer editor requests.”
Server is the librarian — editor asks where is definition of User, server knows every shelf in the project.
- Client starts server via cmd
- Client sends initialize with root
- Server indexes workspace files
- Client sends textDocument/hover etc
- Server replies with location/markers
- Language-specific per project
- Runs out-of-process
- Communicates via JSON-RPC
- Advertises capabilities on init
vim.lsp.config['clangd'] = {cmd={'clangd'}}- Built from: Language Server Protocol — server speaks protocol
- Related: LSP Client — client talks to server
- Builds into: LSP Semantic Tokens — server provides tokens
- Related: LSP Configuration — configures server
- Starting heavy server on huge monorepo slows init
- Mismatched filetypes — server not attached