Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

eslint: Allow configuring `workingDirectory` (#22972)

Thorsten Ball3d80b21a91ab
diff --git a/crates/languages/src/typescript.rs b/crates/languages/src/typescript.rs
index 3a0291feb5d..e549aaf997b 100644
--- a/crates/languages/src/typescript.rs
+++ b/crates/languages/src/typescript.rs
@@ -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()
diff --git a/docs/src/languages/javascript.md b/docs/src/languages/javascript.md
index 7e74cbbfaeb..e2b69a0961b 100644
--- a/docs/src/languages/javascript.md
+++ b/docs/src/languages/javascript.md
@@ -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
- [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.