eslint: Allow configuring workingDirectory (#22972)

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" }}}}}`
This commit is contained in:
Thorsten Ball 2025-01-10 23:21:51 +01:00 committed by GitHub
parent 05b48e8877
commit 3d80b21a91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View file

@ -379,6 +379,11 @@ impl LspAdapter for EsLintLspAdapter {
}
}
let working_directory = eslint_user_settings
.get("workingDirectory")
.cloned()
.unwrap_or_else(|| json!({"mode": "auto"}));
let problems = eslint_user_settings
.get("problems")
.cloned()
@ -400,7 +405,7 @@ impl LspAdapter for EsLintLspAdapter {
"rulesCustomizations": rules_customizations,
"run": "onType",
"nodePath": node_path,
"workingDirectory": {"mode": "auto"},
"workingDirectory": working_directory,
"workspaceFolder": {
"uri": workspace_root,
"name": workspace_root.file_name()