mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-10 05:37:29 +03:00
a52177fd39
This fixes #8533 by allowing users to specify the settings that are passed to ESLint on workspace initialization. Example Zed `settings.json` to enable `fixAll` for eslint when saving/formatting, but only for the `import/order` rule: ```json { "languages": { "JavaScript": { "code_actions_on_format": { "source.fixAll.eslint": true } } }, "lsp": { "eslint": { "settings": { "codeActionOnSave": { "rules": ["import/order"] } } }, } } ``` The possible settings are described in the README of `vscode-eslint` here: https://github.com/Microsoft/vscode-eslint?tab=readme-ov-file#settings-options - `eslint.codeActionsOnSave.enable` (default: `true`, config key in Zed: `lsp.eslint.settings.codeActionOnSave.enable`) - `eslint.codeActionsOnSave.mode` (default: not set by Zed, config key in Zed: `lsp.eslint.settings.codeActionOnSave.mode`) - `eslint.codeActionsOnSave.rules` (default: `[]`, config key in Zed: `lsp.eslint.settings.codeActionOnSave.rules`) Yes, in the readme it's plural: `codeActionsOnSave`, but since `eslint-vscode` we're using this old release: https://github.com/microsoft/vscode-eslint/releases/tag/release%2F2.2.20-Insider We use the singular version: https://github.com/microsoft/vscode-eslint/blob/release/2.2.20-Insider/server/src/eslintServer.ts#L461 Our schema looks like this: ```json { "lsp": { "eslint": { "settings": { "codeActionOnSave": { "enable": true, "rules": ["import/order"], "mode": "all" } } }, } } ``` We should probably fix this and upgrade to the newest version of ESLint. Release Notes: - Added ability for users to configure settings for ESLint's `codeActionOnSave`, e.g. specifying `rules` that should be respected when also using `"code_actions_on_format": {"source.fixAll.eslint": true}`. These settings can be passed to ESLint as part of the `"lsp"` part of the Zed settings. Example: `{"lsp": {"eslint": {"settings": {"codeActionOnSave": { "rules": ["import/order"] }}}}}` ([#8533](https://github.com/zed-industries/zed/issues/8533)). Demo: https://github.com/zed-industries/zed/assets/1185253/5c0cf900-9acb-4a70-b89d-49b6eeb6f0e4 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE-GPL |