Allow users to configure ESLint's problems
settings (#9981)
Presently the only available setting under `problems` is `shortenToSingleLine`, which defaults to `false`. Example Zed `settings.json` to shorten eslint error squiggles to only show on the first line of the problem: ```json { "lsp": { "eslint": { "settings": { "problems": { "shortenToSingleLine": true } } } } } ``` Release Notes: - Added support for configuring ESLint `problems` settings, ie. `{"lsp": {"eslint": {"settings": {"problems": {"shortenToSingleLine": true}}}}}` Demo: https://github.com/zed-industries/zed/assets/2072378/379faa75-1f37-4fd1-85da-1510f1397d07
This commit is contained in:
parent
5a2a85a7db
commit
463c16a402
2 changed files with 24 additions and 1 deletions
|
@ -273,6 +273,11 @@ impl LspAdapter for EsLintLspAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let problems = eslint_user_settings
|
||||||
|
.get("problems")
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_else(|| json!({}));
|
||||||
|
|
||||||
let node_path = eslint_user_settings.get("nodePath").unwrap_or(&Value::Null);
|
let node_path = eslint_user_settings.get("nodePath").unwrap_or(&Value::Null);
|
||||||
let use_flat_config = Self::FLAT_CONFIG_FILE_NAMES
|
let use_flat_config = Self::FLAT_CONFIG_FILE_NAMES
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -290,7 +295,7 @@ impl LspAdapter for EsLintLspAdapter {
|
||||||
"name": workspace_root.file_name()
|
"name": workspace_root.file_name()
|
||||||
.unwrap_or_else(|| workspace_root.as_os_str()),
|
.unwrap_or_else(|| workspace_root.as_os_str()),
|
||||||
},
|
},
|
||||||
"problems": {},
|
"problems": problems,
|
||||||
"codeActionOnSave": code_action_on_save,
|
"codeActionOnSave": code_action_on_save,
|
||||||
"experimental": {
|
"experimental": {
|
||||||
"useFlatConfig": use_flat_config,
|
"useFlatConfig": use_flat_config,
|
||||||
|
|
|
@ -85,3 +85,21 @@ You can configure ESLint's `nodePath` setting (requires Zed `0.127.0`):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Configure ESLint's `problems.shortenToSingleLine`:
|
||||||
|
|
||||||
|
You can configure ESLint's `problems.shortenToSingleLine` setting (requires Zed `0.130.x`):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"lsp": {
|
||||||
|
"eslint": {
|
||||||
|
"settings": {
|
||||||
|
"problems": {
|
||||||
|
"shortenToSingleLine": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue