diff --git a/docs/src/configuring-languages.md b/docs/src/configuring-languages.md index ef5adf97a0618f0b3dbb409b029003c0b74cb125..afb5729ff711a3855d986a77532670eac84232d0 100644 --- a/docs/src/configuring-languages.md +++ b/docs/src/configuring-languages.md @@ -320,8 +320,8 @@ To run linter fixes automatically on save: ```json "languages": { "JavaScript": { - "code_actions_on_format": { - "source.fixAll.eslint": true + "formatter": { + "code_action": "source.fixAll.eslint" } } } @@ -334,15 +334,17 @@ Zed allows you to run both formatting and linting on save. Here's an example tha ```json "languages": { "JavaScript": { - "formatter": { - "external": { - "command": "prettier", - "arguments": ["--stdin-filepath", "{buffer_path}"] + "formatter": [ + { + "code_action": "source.fixAll.eslint" + }, + { + "external": { + "command": "prettier", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } } - }, - "code_actions_on_format": { - "source.fixAll.eslint": true - }, + ], "format_on_save": "on" } } diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index 6acb8ca7178868c235b76a740ec79fb349fbdea1..6f2e1319ee6805c6a7651c7c53571bb972c46457 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -1745,74 +1745,6 @@ WARNING: `{buffer_path}` should not be used to direct your formatter to read fro Here `rust-analyzer` will be used first to format the code, followed by a call of sed. If any of the formatters fails, the subsequent ones will still be executed. -## Code Actions On Format - -- Description: The code actions to perform with the primary language server when formatting the buffer. -- Setting: `code_actions_on_format` -- Default: `{}`, except for Go it's `{ "source.organizeImports": true }` - -**Examples** - - - -1. Organize imports on format in TypeScript and TSX buffers: - -```json -{ - "languages": { - "TypeScript": { - "code_actions_on_format": { - "source.organizeImports": true - } - }, - "TSX": { - "code_actions_on_format": { - "source.organizeImports": true - } - } - } -} -``` - -2. Run ESLint `fixAll` code action when formatting: - -```json -{ - "languages": { - "JavaScript": { - "code_actions_on_format": { - "source.fixAll.eslint": true - } - } - } -} -``` - -3. Run only a single ESLint rule when using `fixAll`: - -```json -{ - "languages": { - "JavaScript": { - "code_actions_on_format": { - "source.fixAll.eslint": true - } - } - }, - "lsp": { - "eslint": { - "settings": { - "codeActionOnSave": { - "rules": ["import/order"] - } - } - } - } -} -``` - ## Auto close - Description: Whether to automatically add matching closing characters when typing opening parenthesis, bracket, brace, single or double quote characters. diff --git a/docs/src/languages/javascript.md b/docs/src/languages/javascript.md index c71071a9b37c74c2226796083af3ae557751da8e..9901708f333bdce8b65e338873f0e611b4e28f87 100644 --- a/docs/src/languages/javascript.md +++ b/docs/src/languages/javascript.md @@ -49,8 +49,8 @@ You can configure Zed to format code using `eslint --fix` by running the ESLint { "languages": { "JavaScript": { - "code_actions_on_format": { - "source.fixAll.eslint": true + "formatter": { + "code_action": "source.fixAll.eslint" } } } @@ -63,8 +63,8 @@ You can also only execute a single ESLint rule when using `fixAll`: { "languages": { "JavaScript": { - "code_actions_on_format": { - "source.fixAll.eslint": true + "formatter": { + "code_action": "source.fixAll.eslint" } } },