<!-- Markdown mirror. Canonical: https://empryo.com/docs/tools/lsp -->

# LSP servers

> Language servers give Empryo exact definitions, references and errors for your code. Empryo installs them for you, and /lsp lets you manage them in the TUI.

A language server is a program that understands one programming language. It powers features like go-to-definition and error checking in code editors. Editors talk to these servers through the Language Server Protocol (LSP). Empryo uses the same servers, so the agent gets accurate answers about your code instead of guessing from text search.

You usually do not need to set anything up. When a session starts, Empryo detects the languages in your project and installs the recommended servers in the background.

## Commands

Run these in the TUI:

```
/lsp                open the LSP manager (install, enable, disable)
/lsp install        search the Mason registry and install servers
/lsp status         running servers with language, backend and PID
/lsp restart        restart all servers, or only some
```

## What the agent uses

When a language server is running for a file, the agent's [code intelligence](/docs/concepts/intelligence) tools ask it first for:

- Go to definition, type definition and implementation
- Find references
- Rename across the workspace
- Diagnostics (errors, warnings and hints)
- Code actions (quick fixes and refactors)
- Call hierarchy (incoming and outgoing calls)
- Type hierarchy (supertypes and subtypes)
- Hover and type information
- Document and workspace symbols
- Format a whole file or a range

The agent picks the right tool for you. You do not need to call these yourself.

## Dual backend

Empryo reaches language servers in one of two ways:

| Mode | When |
|------|------|
| **Neovim bridge** | The [editor panel](/docs/tools/editor) is open. Requests go through the language servers your Neovim already runs, so there is no extra startup. |
| **Standalone** | Neovim is not running, or you use headless mode. Empryo starts the servers itself. |

Both modes give the agent the same features. To limit memory use, Empryo keeps up to 6 standalone servers running at once and stops the one idle the longest when it needs room.

## Supported languages

Empryo recognizes more than 40 languages and file types. For each one it knows the file extensions, how to find the project root, and which language server to use when one exists.

Languages with a known language server include TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, Scala, C#, Swift, Dart, Elixir, OCaml, Lua, C, C++, Objective-C, Ruby, PHP, Zig, Bash, CSS, HTML, JSON, TOML, YAML, Dockerfile, Vue, GraphQL, Protobuf, Markdown, Nix, HCL/Terraform, Bazel/Starlark, Jsonnet, ReScript, Solidity and Emacs Lisp.

You can install any other server from the Mason registry with `/lsp install`.

When no language server covers a file, or a server cannot answer, Empryo falls back to lighter tools, in this order:

1. ts-morph, a TypeScript and JavaScript parser.
2. Tree-sitter, a fast parser that works for many languages.
3. Regular-expression search.

## Mason installer

[Mason](https://github.com/mason-org/mason-registry) is a public registry of language servers and developer tools, first built for Neovim. `/lsp install` opens a searchable list of its packages. Pick one and press <kbd>Enter</kbd>. Empryo installs it based on the package type:

- **npm** packages go into `~/.empryo/lsp-servers/`
- **PyPI** packages install with `pip3`
- **Cargo** packages install with `cargo install`
- **Go** packages install with `go install`
- **GitHub** release files are downloaded and unpacked

On Windows, the install folder is `%LOCALAPPDATA%\Empryo\lsp-servers\`.

PyPI, Cargo and Go packages need that toolchain on your computer. Automatic installs skip a package when its toolchain is missing.

If a server is already on your `PATH`, or installed by Neovim's Mason, Empryo uses that copy.

## Settings

| Setting | Default | What it does |
|---------|---------|--------------|
| `lspAutoInstall` | `true` | Installs recommended servers for your project's languages when a session starts. It installs at most 3 per start and tries each package only once per project. |
| `disabledLspServers` | `[]` | Mason package names Empryo should never start. A project config replaces the global list. You can also toggle servers in `/lsp`. |

See [Configuration](/docs/reference/configuration) for where these settings live.

## Check health

Run `/diagnose` to check tree-sitter, language servers and semantic indexing. Use it when code navigation seems wrong or slow.
