This addresses this comment here: https://github.com/zed-industries/zed/issues/9648#issuecomment-2579246865 Release Notes: - Added ability to configure `workingDirectory` when using ESLint. Example: `{"lsp": {"eslint": {"settings": {"workingDirectory": {"mode": "auto" }}}}}`
Unified · Split
| @@ -379,6 +379,11 @@ impl LspAdapter for EsLintLspAdapter { · 378 unmodified lines | ||
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | + let working_directory = eslint_user_settings | |
| 383 | + .get("workingDirectory") | |
| 384 | + .cloned() | |
| 385 | + .unwrap_or_else(|| json!({"mode": "auto"})); | |
| 386 | + | |
| 382 | 387 | let problems = eslint_user_settings |
| 383 | 388 | .get("problems") |
| 384 | 389 | .cloned() |
| @@ -400,7 +405,7 @@ impl LspAdapter for EsLintLspAdapter { · 15 unmodified lines | ||
| 400 | 405 | "rulesCustomizations": rules_customizations, |
| 401 | 406 | "run": "onType", |
| 402 | 407 | "nodePath": node_path, |
| 403 | − "workingDirectory": {"mode": "auto"}, | |
| 408 | + "workingDirectory": working_directory, | |
| 404 | 409 | "workspaceFolder": { |
| 405 | 410 | "uri": workspace_root, |
| 406 | 411 | "name": workspace_root.file_name() |
| @@ -153,6 +153,24 @@ You can configure ESLint's `rulesCustomizations` setting: · 152 unmodified lines | ||
| 153 | 153 | } |
| 154 | 154 | ``` |
| 155 | 155 | |
| 156 | +### Configure ESLint's `workingDirectory`: | |
| 157 | + | |
| 158 | +You can configure ESLint's `workingDirectory` setting: | |
| 159 | + | |
| 160 | +```json | |
| 161 | +{ | |
| 162 | + "lsp": { | |
| 163 | + "eslint": { | |
| 164 | + "settings": { | |
| 165 | + "workingDirectory": { | |
| 166 | + "mode": "auto" | |
| 167 | + } | |
| 168 | + } | |
| 169 | + } | |
| 170 | + } | |
| 171 | +} | |
| 172 | +``` | |
| 173 | + | |
| 156 | 174 | ## See also |
| 157 | 175 | |
| 158 | 176 | - [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn. |