--- title: Stainless Language Server | Stainless description: Set up the Stainless Language Server in your editor for real-time diagnostics, intelligent completions, and navigation in your Stainless config and OpenAPI spec. --- The SDK Studio provides IntelliSense, diagnostics, and navigation tools for your Stainless projects. The Stainless Language Server brings these features to your local development environment. ## Prerequisites Before you begin, ensure you have: - A code editor installed (VS Code, Cursor, Zed, Neovim, or any LSP-compatible editor) - A Stainless account - A Stainless project with configuration files ## Setup ### 1 Install the Stainless CLI To use the Stainless Language Server, first install the [Stainless CLI](https://github.com/stainless-api/stainless-api-cli). **Install with Homebrew** (recommended for macOS): Terminal window ``` brew tap stainless-api/tap brew install stl ``` **Or with Go**: Terminal window ``` go install 'github.com/stainless-api/stainless-api-cli/cmd/stl@latest' ``` To verify the installation: Terminal window ``` stl --version ``` ### 2 Set up your workspace The extension operates on Stainless workspaces. Initialize your workspace by running: Terminal window ``` stl init ``` This creates a `.stainless/workspace.json` file: ``` ✓ Created workspace configuration at .stainless/workspace.json ``` The extension uses this file to identify your Stainless workspace and provide language support for your configuration files. If you are working with an existing Stainless project, it may already have this file. ### 3 Install the extension for your editor - [VS Code](#tab-panel-8) - [Cursor](#tab-panel-9) - [Zed](#tab-panel-10) - [Neovim](#tab-panel-11) - [Other](#tab-panel-12) Install the extension from the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=stainless.vscode-stainless), or search for “Stainless” in the **Extensions** view (`Ctrl+Shift+X` / `Cmd+Shift+X`). ![VSCode Marketplace](/assets/guides/lsp/demo-vscode-marketplace.png) Cursor uses the [OpenVSX registry](https://open-vsx.org/extension/stainless/vscode-stainless), but you can install the extension the same way as in Visual Studio Code. Search for “Stainless” in the **Extensions** view (`Ctrl+Shift+X` / `Cmd+Shift+X`). A Stainless extension for Zed is available, but not yet published in the extensions marketplace. If you would like to try it, reach out to or contact your Stainless sales representative. Install the language server package globally: Terminal window ``` npm install -g @stainless-api/stainless-language-server ``` Add to your Neovim configuration (e.g., `~/.config/nvim/init.lua`): ``` vim.lsp.config['stainless'] = { cmd = { 'stainless-language-server', '--stdio' }, filetypes = { 'yaml', 'json' }, root_markers = { '.stainless/workspace.json' }, } vim.lsp.enable('stainless') ``` [`vim.lsp.enable()`](https://neovim.io/doc/user/lsp.html#vim.lsp.enable\(\)) activates the language server for the specified filetypes. The server automatically starts when you open a YAML or JSON file in a directory containing `.stainless/workspace.json`. **Add the YAML language server** For YAML features like schema validation and formatting, install the YAML language server: Terminal window ``` npm install -g yaml-language-server ``` Then add this configuration: ``` vim.lsp.config['yamlls'] = { cmd = { 'yaml-language-server', '--stdio' }, filetypes = { 'yaml' }, root_markers = { '.git' }, } vim.lsp.enable('yamlls') ``` Both language servers run simultaneously on the same YAML files. For any editor that supports the Language Server Protocol (LSP), install the language server package globally, as well as the [yaml-language-server](https://github.com/redhat-developer/yaml-language-server) for general YAML editor features. Terminal window ``` npm install -g @stainless-api/stainless-language-server ``` Then configure your editor to use the Stainless language server: - **Command**: `stainless-language-server --stdio` - **File types**: `*.yml`, `*.yaml`, `*.json` - **Root directory**: Directory containing `.stainless/workspace.json` Refer to your editor’s LSP configuration documentation for specific setup instructions. ### 4 Verify the installation After installing the extension, open a workspace containing Stainless configuration files. The extension activates automatically when it detects a `.stainless/workspace.json` file. To verify the extension is working: 1. Open a `stainless.yaml` or `stainless.yml` file in your workspace 2. For VS Code and Cursor, check the status bar in the bottom right corner for the Stainless icon ![Editor status bar showing the active Stainless extension indicator](/docs/_astro/demo-status-bar.D8B8YY8I_Z4JoG1.webp) If the extension does not activate, ensure your workspace has a `.stainless/workspace.json` file created by running `stl init`. ## Features ### Real-time SDK diagnostics The language server analyzes your Stainless config and OpenAPI spec in real-time, surfacing errors, warnings, and suggestions directly in your editor. This helps you catch issues before running a build. ![Diagnostics demo showing real-time error detection in the Stainless config file](/docs/_astro/demo-diagnostics.C1ZCH55R_ZxuIt0.webp) ### Go to definition and find all references Use **Go to definition** (`F12` or `Cmd+Click`) to jump directly from your Stainless config to schema definitions, parameters, and response types in your OpenAPI spec. Use **Find all references** (`Shift+F12`) to see everywhere a schema or endpoint is used across your config and spec files. ![Go to definition demo showing navigation from config to OpenAPI spec schema definitions](/docs/_astro/demo-go-to-definition.VtsLUPeF_21k1BN.webp) ### Intelligent completions in your Stainless config The language server provides context-aware autocompletion to speed up editing. It suggests valid config options, endpoints, and schema names based on your OpenAPI spec. ![Completions demo showing context-aware autocompletion suggestions in the Stainless config](/docs/_astro/demo-completions.BDYYk8Uj_Z1ARfzu.webp) ### Quick fixes and code actions Resolve diagnostics with one click using code actions. Common diagnostics have an Autofix option, and you can easily ignore any warning diagnostic. ![Quick fix demo showing one-click code actions to resolve diagnostics](/docs/_astro/demo-quick-fixes.CYSoWewa_Z17KQ3X.webp) ### Codelenses for your OpenAPI spec Codelenses appear inline in your OpenAPI spec to show which schemas and endpoints are configured in your Stainless config. This makes it easy to see at a glance how your API is represented in your SDKs. ![Codelenses demo showing inline indicators in OpenAPI spec for configured schemas and endpoints](/docs/_astro/demo-codelenses.6baeXZVd_Z1wJ3W3.webp) ### Live transformations The language server automatically generates and updates your transformed OpenAPI spec in real-time as you edit your config. Learn more about [transforms](/docs/openapi/transforms/index.md).