ruff/docs/editors/index.md
Dhruv Manilawala 648cca199b
Add docs for Ruff language server (#12344)
## Summary

This PR adds documentation for the Ruff language server.

It mainly does the following:
1. Combines various READMEs containing instructions for different editor
setup in their respective section on the online docs
2. Provide an enumerated list of server settings. Additionally, it also
provides a section for VS Code specific options.
3. Adds a "Features" section which enumerates all the current
capabilities of the native server

For (2), the settings documentation is done manually but a future
improvement (easier after `ruff-lsp` is deprecated) is to move the docs
in to Rust struct and generate the documentation from the code itself.
And, the VS Code extension specific options can be generated by diffing
against the `package.json` in `ruff-vscode` repository.

### Structure

1. Setup: This section contains the configuration for setting up the
language server for different editors
2. Features: This section contains a list of capabilities provided by
the server along with short GIF to showcase it
3. Settings: This section contains an enumerated list of settings in a
similar format to the one for the linter / formatter
4. Migrating from `ruff-lsp`

> [!NOTE]
>
> The settings page is manually written but could possibly be
auto-generated via a macro similar to `OptionsMetadata` on the
`ClientSettings` struct

resolves: #11217 

## Test Plan

Generate and open the documentation locally using:
1. `python scripts/generate_mkdocs.py`
2. `mkdocs serve -f mkdocs.insiders.yml`
2024-07-18 17:41:43 +05:30

27 lines
1.6 KiB
Markdown

# Editor Integrations
Ruff can be integrated with various editors and IDEs to provide a seamless development experience.
This section provides instructions on [how to set up Ruff with your editor](./setup.md) and [configure it to your
liking](./settings.md).
## Language Server Protocol
The editor integration is mainly powered by the Ruff Language Server which implements the
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/). The server is
written in Rust and is available as part of the `ruff` CLI via `ruff server`. It is a single, common
backend built directly into Ruff, and a direct replacement for [`ruff-lsp`](https://github.com/astral-sh/ruff-lsp),
our previous language server. You can read more about `ruff server` in the
[`v0.4.5` blog post](https://astral.sh/blog/ruff-v0.4.5).
The server supports surfacing Ruff diagnostics, providing Code Actions to fix them, and
formatting the code using Ruff's built-in formatter. Currently, the server is intended to be used
alongside another Python Language Server in order to support features like navigation and
autocompletion.
The Ruff Language Server was available first in Ruff [v0.4.5](https://astral.sh/blog/ruff-v0.4.5)
in beta and stabilized in Ruff [v0.5.3](https://github.com/astral-sh/ruff/releases/tag/0.5.3).
!!! note
This is the documentation for Ruff's built-in language server written in Rust (`ruff server`).
If you are looking for the documentation for the `ruff-lsp` language server, please refer to the
[README](https://github.com/astral-sh/ruff-lsp) of the `ruff-lsp` repository.