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:
parent
05b48e8877
commit
3d80b21a91
2 changed files with 24 additions and 1 deletions
|
@ -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
|
let problems = eslint_user_settings
|
||||||
.get("problems")
|
.get("problems")
|
||||||
.cloned()
|
.cloned()
|
||||||
|
@ -400,7 +405,7 @@ impl LspAdapter for EsLintLspAdapter {
|
||||||
"rulesCustomizations": rules_customizations,
|
"rulesCustomizations": rules_customizations,
|
||||||
"run": "onType",
|
"run": "onType",
|
||||||
"nodePath": node_path,
|
"nodePath": node_path,
|
||||||
"workingDirectory": {"mode": "auto"},
|
"workingDirectory": working_directory,
|
||||||
"workspaceFolder": {
|
"workspaceFolder": {
|
||||||
"uri": workspace_root,
|
"uri": workspace_root,
|
||||||
"name": workspace_root.file_name()
|
"name": workspace_root.file_name()
|
||||||
|
|
|
@ -153,6 +153,24 @@ You can configure ESLint's `rulesCustomizations` setting:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configure ESLint's `workingDirectory`:
|
||||||
|
|
||||||
|
You can configure ESLint's `workingDirectory` setting:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"lsp": {
|
||||||
|
"eslint": {
|
||||||
|
"settings": {
|
||||||
|
"workingDirectory": {
|
||||||
|
"mode": "auto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.
|
- [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue