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
379379 }
380380 }
381381
382+ let working_directory = eslint_user_settings
383+ .get("workingDirectory")
384+ .cloned()
385+ .unwrap_or_else(|| json!({"mode": "auto"}));
386+
382387 let problems = eslint_user_settings
383388 .get("problems")
384389 .cloned()
@@ -400,7 +405,7 @@ impl LspAdapter for EsLintLspAdapter { · 15 unmodified lines
400405 "rulesCustomizations": rules_customizations,
401406 "run": "onType",
402407 "nodePath": node_path,
403− "workingDirectory": {"mode": "auto"},
408+ "workingDirectory": working_directory,
404409 "workspaceFolder": {
405410 "uri": workspace_root,
406411 "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
153153 }
154154 ```
155155
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+
156174 ## See also
157175
158176 - [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