From ee1b1779f181bbf4fe978569eb90f2c3bca9c5db Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Thu, 4 Apr 2024 14:12:28 +0200 Subject: [PATCH] Document `formatter: code_actions` (#10157) This documents what was introduced in #10121 and shipped in 0.130.x Release Notes: - N/A --- docs/src/configuring_zed.md | 15 +++++++++++++++ docs/src/languages/javascript.md | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/docs/src/configuring_zed.md b/docs/src/configuring_zed.md index 6d5b383468..e62ac95eec 100644 --- a/docs/src/configuring_zed.md +++ b/docs/src/configuring_zed.md @@ -306,6 +306,21 @@ To override settings for a language, add an entry for that language server's nam } ``` +3. Or to use code actions provided by the connected language servers, use `"code_actions"` (requires Zed `0.130.x`): + +```json +{ + "formatter": { + "code_actions": { + // Use ESLint's --fix: + "source.fixAll.eslint": true, + // Organize imports on save: + "source.organizeImports": true + } + } +} +``` + ## Code Actions On Format - Description: The code actions to perform with the primary language server when formatting the buffer. diff --git a/docs/src/languages/javascript.md b/docs/src/languages/javascript.md index bb7deb9def..9ddd277640 100644 --- a/docs/src/languages/javascript.md +++ b/docs/src/languages/javascript.md @@ -69,6 +69,23 @@ So if your language server or prettier configuration don't format according to ESLint's rules, then they will overwrite what ESLint fixed and you end up with errors. +If you **only** want to run ESLint on save, you can configure code actions as +the formatter (requires Zed `0.130.x`): + +```json +{ + "languages": { + "JavaScript": { + "formatter": { + "code_actions": { + "source.fixAll.eslint": true + } + } + } + } +} +``` + #### Configure ESLint's `nodePath`: You can configure ESLint's `nodePath` setting (requires Zed `0.127.0`):