From 5509a3d7ae723b3af61a4daccd7e45f7d1ea40b7 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Thu, 12 Dec 2024 07:14:56 +0000 Subject: [PATCH] Add LSP settings example for Zed editor (#14894) ## Summary Add Zed settings examples to in addition to NeoVim and VSCode. Screenshot 2024-12-11 at 9 54 57 ## Test Plan [*] Tested locally. No errors. Looks fine to me. --- docs/editors/settings.md | 294 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 294 insertions(+) diff --git a/docs/editors/settings.md b/docs/editors/settings.md index cb695f43e95f9..9eb444c2daf30 100644 --- a/docs/editors/settings.md +++ b/docs/editors/settings.md @@ -40,6 +40,21 @@ behavior of the Ruff CLI. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "configuration": "~/path/to/ruff.toml" + } + } + } + } + } + ``` + ### `configurationPreference` The strategy to use when resolving settings across VS Code and the filesystem. By default, editor @@ -74,6 +89,21 @@ configuration is prioritized over `ruff.toml` and `pyproject.toml` files. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "configurationPreference": "filesystemFirst" + } + } + } + } + } + ``` + ### `exclude` A list of file patterns to exclude from linting and formatting. See [the @@ -103,6 +133,21 @@ documentation](https://docs.astral.sh/ruff/settings/#exclude) for more details. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "exclude": ["**/tests/**"] + } + } + } + } + } + ``` + ### `lineLength` The line length to use for the linter and formatter. @@ -131,6 +176,21 @@ The line length to use for the linter and formatter. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "lineLength": 100 + } + } + } + } + } + ``` + ### `fixAll` Whether to register the server as capable of handling `source.fixAll` code actions. @@ -159,6 +219,21 @@ Whether to register the server as capable of handling `source.fixAll` code actio } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "fixAll": false + } + } + } + } + } + ``` + ### `organizeImports` Whether to register the server as capable of handling `source.organizeImports` code actions. @@ -187,6 +262,21 @@ Whether to register the server as capable of handling `source.organizeImports` c } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "organizeImports": false + } + } + } + } + } + ``` + ### `showSyntaxErrors` _New in Ruff [v0.5.0](https://astral.sh/blog/ruff-v0.5.0#changes-to-e999-and-reporting-of-syntax-errors)_ @@ -217,6 +307,21 @@ Whether to show syntax error diagnostics. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "showSyntaxErrors": false + } + } + } + } + } + ``` + ### `logLevel` The log level to use for the server. @@ -245,6 +350,21 @@ The log level to use for the server. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "logLevel": "debug" + } + } + } + } + } + ``` + ### `logFile` Path to the log file to use for the server. @@ -275,6 +395,21 @@ If not set, logs will be written to stderr. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "logFile": "~/path/to/ruff.log" + } + } + } + } + } + ``` + ## `codeAction` Enable or disable code actions provided by the server. @@ -311,6 +446,25 @@ Whether to display Quick Fix actions to disable rules via `noqa` suppression com } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "codeAction": { + "disableRuleComment": { + "enable": false + } + } + } + } + } + } + } + ``` + ### `fixViolation.enable` Whether to display Quick Fix actions to autofix violations. @@ -343,6 +497,25 @@ Whether to display Quick Fix actions to autofix violations. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "codeAction": { + "fixViolation": = { + "enable": false + } + } + } + } + } + } + } + ``` + ## `lint` Settings specific to the Ruff linter. @@ -377,6 +550,25 @@ Whether to enable linting. Set to `false` to use Ruff exclusively as a formatter } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "lint": { + "enable" = { + "enable": false + } + } + } + } + } + } + } + ``` + ### `preview` {: #lint_preview } Whether to enable Ruff's preview mode when linting. @@ -407,6 +599,23 @@ Whether to enable Ruff's preview mode when linting. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "lint": { + "preview": true + } + } + } + } + } + } + ``` + ### `select` Rules to enable by default. See [the documentation](https://docs.astral.sh/ruff/settings/#lint_select). @@ -437,6 +646,23 @@ Rules to enable by default. See [the documentation](https://docs.astral.sh/ruff/ } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "lint": { + "select": ["E", "F"] + } + } + } + } + } + } + ``` + ### `extendSelect` Rules to enable in addition to those in [`lint.select`](#select). @@ -467,6 +693,23 @@ Rules to enable in addition to those in [`lint.select`](#select). } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "lint": { + "extendSelect": ["W"] + } + } + } + } + } + } + ``` + ### `ignore` Rules to disable by default. See [the documentation](https://docs.astral.sh/ruff/settings/#lint_ignore). @@ -497,6 +740,23 @@ Rules to disable by default. See [the documentation](https://docs.astral.sh/ruff } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "lint": { + "ignore": ["E4", "E7"] + } + } + } + } + } + } + ``` + ### `extendIgnore` Rules to disable in addition to those in [`lint.ignore`](#ignore). @@ -527,6 +787,23 @@ Rules to disable in addition to those in [`lint.ignore`](#ignore). } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "lint": { + "extendIgnore": ["W1"] + } + } + } + } + } + } + ``` + ## `format` Settings specific to the Ruff formatter. @@ -561,6 +838,23 @@ Whether to enable Ruff's preview mode when formatting. } ``` +=== "Zed" + ```json + { + "lsp": { + "ruff": { + "initialization_options": { + "settings": { + "format": { + "preview": true + } + } + } + } + } + } + ``` + ## VS Code specific Additionally, the Ruff extension provides the following settings specific to VS Code. These settings