Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supported settings to README #469

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,39 @@ This requires Ruff version `v0.1.3` or later.

## Settings

| Settings | Default | Description |
| ------------------------------------ | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| codeAction.disableRuleComment.enable | `true` | Whether to display Quick Fix actions to disable rules via `noqa` suppression comments. |
| codeAction.fixViolation.enable | `true` | Whether to display Quick Fix actions to autofix violations. |
| enable | `true` | Whether to enable the Ruff extension. Modifying this setting requires restarting VS Code to take effect. |
| fixAll | `"explicit"` | Whether to register Ruff as capable of handling `source.fixAll` actions. |
| ignoreStandardLibrary | `true` | Whether to ignore files that are inferred to be part of the Python standard library. |
| importStrategy | `fromEnvironment` | Strategy for loading the `ruff` executable. `fromEnvironment` picks up Ruff from the environment, falling back to the bundled version if needed. `useBundled` uses the version bundled with the extension. |
| interpreter | `[]` | Path to a Python interpreter to use to run the linter server. |
| lint.args | `[]` | Additional command-line arguments to pass to `ruff check`, e.g., `"args": ["--config=/path/to/pyproject.toml"]`. Supports a subset of Ruff's command-line arguments, ignoring those that are required to operate the LSP, like `--force-exclude` and `--verbose`. |
| lint.enable | `true` | Whether to enable linting. Set to `false` to use Ruff exclusively as a formatter. |
| lint.run | `onType` | Run Ruff on every keystroke (`onType`) or on save (`onSave`). |
| organizeImports | `"explicit"` | Whether to register Ruff as capable of handling `source.organizeImports` actions. |
| path | `[]` | Path to a custom `ruff` executable, e.g., `["/path/to/ruff"]`. |
| showNotifications | `off` | Setting to control when a notification is shown: `off`, `onError`, `onWarning`, `always`. |
| Settings | Default | Description |
| -------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `codeAction.disableRuleComment.enable` | `true` | Whether to display Quick Fix actions to disable rules via `noqa` suppression comments. |
| `codeAction.fixViolation.enable` | `true` | Whether to display Quick Fix actions to autofix violations. |
| `enable` | `true` | Whether to enable the Ruff extension. Modifying this setting requires restarting VS Code to take effect. |
| `fixAll` | `"explicit"` | Whether to register Ruff as capable of handling `source.fixAll` actions. |
| `ignoreStandardLibrary` | `true` | Whether to ignore files that are inferred to be part of the Python standard library. |
| `importStrategy` | `fromEnvironment` | Strategy for loading the `ruff` executable. `fromEnvironment` finds Ruff in the environment, falling back to the bundled version; `useBundled` uses the version bundled with the extension. |
| `interpreter` | `[]` | Path to a Python interpreter to use to run the linter server. |
| `lint.args` | `[]` | Additional command-line arguments to pass to `ruff check`, e.g., `"args": ["--config=/path/to/pyproject.toml"]`. _This setting is **not** supported under `nativeServer: true`._ |
| `lint.enable` | `true` | Whether to enable linting. Set to `false` to use Ruff exclusively as a formatter. |
| `lint.run` | `onType` | Run Ruff on every keystroke (`onType`) or on save (`onSave`). |
| `format.args` | `[]` | Additional command-line arguments to pass to `ruff format`. _This setting is **not** supported under `nativeServer: true`._ |
| `organizeImports` | `"explicit"` | Whether to register Ruff as capable of handling `source.organizeImports` actions. |
| `path` | `[]` | Path to a custom `ruff` executable, e.g., `["/path/to/ruff"]`. |
| `showNotifications` | `off` | Setting to control when a notification is shown: `off`, `onError`, `onWarning`, `always`. |
| `nativeServer` | `false` | Whether to use the Rust-based language server. |

The following settings are exclusive to the Rust-based language server (`nativeServer: true`), and
are available in addition to those listed above:

| Settings | Default | Description |
| ------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `configuration` | `null` | Path to a `ruff.toml` or `pyproject.toml` file to use for configuration. |
| `configurationPreference` | `editorFirst` | The strategy to use when resolving settings across VS Code and the filesystem. By default, editor configuration is prioritized over `ruff.toml` and `pyproject.toml` files. |
| `exclude` | `[]` | Glob patterns to exclude files from linting. |
| `lineLength` | `88` | The line length to use for the linter and formatter. |
| `lint.preview` | `false` | Whether to enable Ruff's preview mode when linting. |
| `lint.select` | `[]` | Rules to enable by default. See [the documentation](https://docs.astral.sh/ruff/settings/#lint_select). |
| `lint.extendSelect` | `[]` | Rules to enable in addition to those in `lint.select`. |
| `lint.ignore` | `[]` | Rules to disable by default. See [the documentation](https://docs.astral.sh/ruff/settings/#lint_ignore). |
| `lint.extendIgnore` | `[]` | Rules to disable in addition to those in `lint.ignore`. |
| `format.preview` | `false` | Whether to enable Ruff's preview mode when formatting. |

### Configuring VS Code

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"properties": {
"ruff.nativeServer": {
"default": false,
"markdownDescription": "Use the new beta language server, integrated with Ruff.",
"markdownDescription": "Use the integrated Rust-based language server, available now in Beta.",
"scope": "window",
"type": "boolean"
},
Expand Down