History

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" }}}}}`

Thorsten Ball committed 1 year ago

Commit 3d80b211 parent 05b48e82 files · +24 −1Browse files

Unified · Split

2 files
  1. crates/languages/src/typescript.rs +6 −1
  2. docs/src/languages/javascript.md +18 −0
crates/languages/src/typescript.rs+6−1
@@ -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 let problems = eslint_user_settings387 let problems = eslint_user_settings
383 .get("problems")388 .get("problems")
384 .cloned()389 .cloned()
@@ -400,7 +405,7 @@ impl LspAdapter for EsLintLspAdapter { · 15 unmodified lines
400 "rulesCustomizations": rules_customizations,405 "rulesCustomizations": rules_customizations,
401 "run": "onType",406 "run": "onType",
402 "nodePath": node_path,407 "nodePath": node_path,
403 "workingDirectory": {"mode": "auto"},408 "workingDirectory": working_directory,
404 "workspaceFolder": {409 "workspaceFolder": {
405 "uri": workspace_root,410 "uri": workspace_root,
406 "name": workspace_root.file_name()411 "name": workspace_root.file_name()
docs/src/languages/javascript.md+18−0
@@ -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
158You 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## See also174## See also
157 175
158- [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.176- [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t