# Language tools

Canonical HTML: [Language tools](https://getred.dev/docs/languages). Website source: `b212874eefaf200143affa21c770fbb8855a4f5c`. Documented Red release: v0.9.1. Installer source: `b86a2ca4b92e9547d3b174910c82db8a259f5171`.

Use completion, diagnostics, navigation, formatting, and language packs for the files in your workspace.

<a id="use-a-language-server"></a>

## Use a language server

Red starts a configured server after you open a matching file. The built-in defaults cover Rust, Fish, Markdown, JavaScript and TypeScript, JSON, TOML, YAML, and Lua; those server executables must be installed separately and available on `PATH`. Red includes its own server for `.hk` and `.husk` files.

`K`Show hover documentation

`gd`Go to definition

`Ctrl-Space`Request completion

`Ctrl-k`Show signature help

`Ctrl-t`Find document symbols

`Space w`Find workspace symbols

`Space k`Find references

`Space .`Show code actions

`Space r`Rename a symbol

`Space f`Format the current document

<a id="completion-and-formatting"></a>

## Completion and formatting

Completion combines words from open buffers with candidates from the active language server. Use the arrow keys or `Ctrl-n`/`Ctrl-p` to choose an item, `Tab` or `Enter` to accept it, and `Ctrl-e` to close the menu.

Red formats supported documents when saving and reindents pasted code by default. Disable either behavior without disabling explicit formatting:

```toml
[formatting]
on_save = false
on_paste = false
```

When format-on-save is pending, `:wq` waits for the save before exiting. Red stays open if the save fails or the buffer changes during formatting.

<a id="add-or-override-a-server"></a>

## Add or override a server

```toml
[lsp.servers.go]
command = "gopls"
language_id = "go"
file_extensions = ["go"]
root_markers = ["go.mod", ".git"]
```

Restart Red after changing a server definition, or run `:languages reload` after changing a unified language definition.

Starting with **v0.9.0**, multiple configured servers with overlapping file extensions or filenames attach to the same buffer automatically, combining diagnostics and code actions while routing completion, hover, and navigation by server capability. [Configure TypeScript and ESLint together](https://getred.dev/docs/languages/typescript-eslint.md)

<a id="install-a-language-pack"></a>

## Install a language pack

Open **Language packs** from the command palette, or use the CLI:

```shell
red plugin catalog
red plugin install --catalog go-language
red plugin install --catalog python-language --trust-native-grammars
```

Native Tree-sitter grammars execute inside the editor. Installing a pack doesn't approve them automatically; trust only the exact verified grammar bytes you intend to load.

```shell
red language trust LANGUAGE_ID
red language untrust LANGUAGE_ID
```
