# Language servers

[← Back to README](../README.md)

![LSP features](images/lsp_features.png)

K3 Studio speaks LSP over stdio JSON-RPC, and each kind of file gets its own server:

| Files | Server |
|---|---|
| Lua | `qbx-lua-ls` |
| JS / TS | `typescript-language-server` |
| CSS / SCSS / LESS, HTML, JSON | `vscode-langservers-extracted` |
| Svelte | `svelte-language-server` |

The web servers are installed once with bun and pinned to fixed versions. You can see each server's state (starting / idle) in the Web panel.

## Features

| Feature | Keys |
|---|---|
| Completion | as you type, `Ctrl+Space` |
| Hover | mouse over |
| Signature help | inside a call |
| Go to definition | `F12` |
| References | `Shift+F12` (opens the References tab) |
| Rename | `F2` |
| Format | `Shift+Alt+F` |
| Inlay hints | parameter names in Lua and TypeScript |

## FiveM-specific checks

- **Wrong-side natives**: calling a server-only native in a client file (and the reverse) is flagged as you type
- **`io` / `os.*` on the client**: flagged in client and shared Lua
- **Cross-resource globals**: a global you use in one resource but define in another (or on another side) is flagged
- **Event and callback names**: names complete inside `Trigger*` / `Register*`, `lib.callback`, ESX and QB calls, using an index of the whole server; `F12` and hover work on them too
- **Whole-folder problems**: Lua workspace diagnostics, plus `tsc` / `svelte-check` per app when you open the folder

![Hover on a server.cfg value](images/hover.png)
