ZIm/crates
Andrey Kuzmin ac74a72a9e
Improve elm-language-server configuration (#7342)
Hi folks! @absynce and I paired a bit to improve the
`elm-language-server` configuration. We have realised that sometimes
`elm-language-server` settings were being reset to default. We had been
configuring `elm-language-server` like this:

```json
"lsp": {
  "elm-language-server": {
    "initialization_options": {
      "disableElmLSDiagnostics": true,
      "onlyUpdateDiagnosticsOnSave": true,
      "elmReviewDiagnostics": "warning"
    }
  }
}
```

And then we noticed that the following communication happened:

```
// Send:
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
// Receive:
{"jsonrpc":"2.0","id":5,"method":"workspace/configuration","params":{"items":[{"section":"elmLS"}]}}
// Send:
{"jsonrpc":"2.0","id":5,"result":[null],"error":null}
```

In `elm-language-server` the settings from `didChangeConfiguration`
[replace the initial
settings](edd6813388/src/common/providers/diagnostics/diagnosticsProvider.ts (L188)).
Setting the value to `{}` effectively resets the configuration options
to defaults.

In Zed, `initialization_options` and `workspace_configuration` are two
different things, but in `elm-language-server` they are coupled.
Additionally, `elm-language-server` is requesting workspace
configuration for the `elmLS` section that doesn't exist.

This PR: 

1. Fixes settings reset on `didChangeConfiguration` by populating
`workspace_configuration` from `initialization_options`
2. Makes workspace configuration requests work by inserting an extra
copy of the settings under the `elmLS` key in `workspace_configuration`
— this is a bit ugly, but we're not sure how to make both kinds of
configuration messages work in the current setup.

This is how communication looks like after the proposed changes:

```
// Send:
{
  "jsonrpc": "2.0",
  "method": "workspace/didChangeConfiguration",
  "params": {
    "settings": {
      "disableElmLSDiagnostics": true,
      "onlyUpdateDiagnosticsOnSave": true,
      "elmReviewDiagnostics": "warning",
      "elmLS": {
        "disableElmLSDiagnostics": true,
        "onlyUpdateDiagnosticsOnSave": true,
        "elmReviewDiagnostics": "warning"
      }
    }
  }
}
// Receive:
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "workspace/configuration",
  "params": {
    "items": [
      {
        "section": "elmLS"
      }
    ]
  }
}
// Send:
{
  "jsonrpc": "2.0",
  "id": 4,
  "result": [
    {
      "disableElmLSDiagnostics": true,
      "onlyUpdateDiagnosticsOnSave": true,
      "elmReviewDiagnostics": "warning"
    }
  ],
  "error": null
}
```

Things we have considered:

1. Extracting the `elm-language-server` settings into a separate
section: we haven't found this being widely used in Zed, seems that all
language server configuration should fall under the top level `lsp`
section
2. Changing the way `elm-language-server` configuration works:
`elm-language-server` has got integrations with multiple editors,
changing the configuration behaviour would mean updating all the
existing integrations. Plus we are not exactly sure if it's doing
anything wrong.

Release Notes:

- Improved elm-language-server configuration options

Co-authored-by: Jared M. Smith <absynce@gmail.com>
2024-02-04 01:57:24 +02:00
..
activity_indicator Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
ai Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
assets Fix some formatting issues in Cargo.toml files (#7127) 2024-01-30 22:01:35 -05:00
assistant assistant: render api key editor if no credentials are set (#7197) 2024-02-01 11:16:03 +01:00
audio Restrict access to global Audio (#7122) 2024-01-30 20:49:58 -05:00
auto_update Dismiss update notification when viewing releases notes (#7297) 2024-02-02 22:52:28 +02:00
breadcrumbs Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
call Do more on channel join (#7268) 2024-02-02 09:52:30 -07:00
channel Links to channel notes (#7262) 2024-02-01 22:22:02 -07:00
cli Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
client Don't log errors on main (#7289) 2024-02-02 19:24:49 -07:00
clock Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
collab Links to channel notes (#7262) 2024-02-01 22:22:02 -07:00
collab_ui Fix main (#7293) 2024-02-02 12:21:45 -05:00
collections gpui: Add Global marker trait (#7095) 2024-01-30 14:08:20 -05:00
color Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
command_palette Fix some typos in comments (#7169) 2024-01-31 16:21:33 -05:00
copilot Send lsp_types::InitializeParams with Zed version (#7216) 2024-02-01 18:39:28 +02:00
copilot_ui WIP: Add a setting to visually redact enviroment variables (#7124) 2024-01-31 11:42:09 -08:00
db Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
diagnostics Fix some formatting issues in Cargo.toml files (#7127) 2024-01-30 22:01:35 -05:00
editor Editor toolbar configuration (#7338) 2024-02-03 22:40:54 +02:00
feature_flags Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
feedback app version to server (#7130) 2024-01-31 15:46:24 -07:00
file_finder Order history items by open recency (#7248) 2024-02-01 23:45:03 +02:00
fs Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
fsevent fix: isolate macos-specific dependencies (#6854) 2024-01-27 13:38:55 +01:00
fuzzy Fix panic in fuzzy-finder for unicode characters (#7080) 2024-01-30 16:10:35 +01:00
git Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
go_to_line Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
gpui Reintroduce ProMotion support (#7347) 2024-02-03 16:33:08 -07:00
gpui_macros Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
install_cli Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
journal Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
language Show diagnostics in scrollbar (#7175) 2024-02-02 12:10:42 +02:00
language_selector Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
language_tools Send lsp_types::InitializeParams with Zed version (#7216) 2024-02-01 18:39:28 +02:00
live_kit_client Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
live_kit_server Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
lsp Support documentation as a resolvable property (#7306) 2024-02-03 22:35:57 +02:00
markdown_preview Fix scrolling and wrapping in the markdown preview renderer (#7234) 2024-02-01 09:07:01 -08:00
media Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
menu Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
multi_buffer Show diagnostics in scrollbar (#7175) 2024-02-02 12:10:42 +02:00
node_runtime Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
notifications Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
outline Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
picker Fix some formatting issues in Cargo.toml files (#7127) 2024-01-30 22:01:35 -05:00
plugin Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
plugin_macros Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
plugin_runtime Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
prettier Send lsp_types::InitializeParams with Zed version (#7216) 2024-02-01 18:39:28 +02:00
project project: Do not inline LSP related methods 2024-02-02 11:38:09 +01:00
project_panel Fix project panel selection related issues (#7245) 2024-02-02 11:17:46 +02:00
project_symbols Send lsp_types::InitializeParams with Zed version (#7216) 2024-02-01 18:39:28 +02:00
quick_action_bar Editor toolbar configuration (#7338) 2024-02-03 22:40:54 +02:00
recent_projects Fix some formatting issues in Cargo.toml files (#7127) 2024-01-30 22:01:35 -05:00
refineable Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
release_channel app version to server (#7130) 2024-01-31 15:46:24 -07:00
rich_text Add inline code blocks in markdown preview (#7277) 2024-02-02 16:51:05 +02:00
rope Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
rpc disallow opening private files (#7165) 2024-01-31 12:05:51 -08:00
search Fix some formatting issues in Cargo.toml files (#7127) 2024-01-30 22:01:35 -05:00
semantic_index Fix some formatting issues in Cargo.toml files (#7127) 2024-01-30 22:01:35 -05:00
settings app version to server (#7130) 2024-01-31 15:46:24 -07:00
snippet Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
sqlez Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
sqlez_macros Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
story Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
storybook Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
sum_tree Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
terminal Add support for relative terminal links (#7303) 2024-02-03 17:04:27 +02:00
terminal_view Add support for relative terminal links (#7303) 2024-02-03 17:04:27 +02:00
text Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
theme Watch the themes directory for changes (#7173) 2024-01-31 18:17:31 -05:00
theme_importer theme_importer: Make VS Code theme parsing more lenient (#7292) 2024-02-02 12:09:05 -05:00
theme_selector Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
ui Fix some formatting issues in Cargo.toml files (#7127) 2024-01-30 22:01:35 -05:00
util Add support for relative terminal links (#7303) 2024-02-03 17:04:27 +02:00
vcs_menu Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
vim vim hml (#7298) 2024-02-02 19:24:36 -07:00
welcome Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
workspace Editor toolbar configuration (#7338) 2024-02-03 22:40:54 +02:00
zed Improve elm-language-server configuration (#7342) 2024-02-04 01:57:24 +02:00
zed_actions Fix casing of OpenZedUrl action (#7045) 2024-01-29 23:50:31 -05:00