a52177fd398038641e032144489472565756085b
codeActionOnSave settings (#8537)
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
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
You can download Zed today for macOS (v10.15+).
Support for additional platforms is on our roadmap:
- Linux (tracking issue)
- Windows (tracking issue)
- Web (tracking issue)
For macOS users, you can also install Zed from Homebrew:
brew install zed
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Description
Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Readme
586 MiB
Languages
Rust
94.7%
JSON-with-Comments
3.1%
Inno Setup
0.6%
Scheme
0.5%
Shell
0.3%
Other
0.4%