Files
neovim/runtime
Mitchell Hanberg a37d568082 fix(lsp): send empty "added" list when removing workspace folder #24440
When adding `workspace/didChangeWorkspaceFolders` support to my [language server](https://github.com/elixir-tools/next-ls), I noticed that when neovim removes a workspace, it sends an empty table (which is serialized to an empty JSON array) for the value in the `added` field.

This does not follow the spec; the `added` table should just be empty.

The following error led me to this discovery. Note the payload includes `"added" => [[]]`:

```
22:46:48.476 [error] LSP Exited.

Last message received: handle_notification %{"jsonrpc" => "2.0", "method" => "workspace/didChangeWorkspaceFolders", "params" => %{"event" => %{"added" => [[]], "removed" => [%{"name" => "/Users/mitchell/src/gen_lsp", "uri" => "file:///Users/mitchell/src/gen_lsp"}]}}}

** (MatchError) no match of right hand side value: {:error, %{"params" => %{"event" => %{"added" => [error: "expected a map"]}}}}
    (gen_lsp 0.4.0) lib/gen_lsp.ex:265: anonymous fn/4 in GenLSP.loop/3
    (gen_lsp 0.4.0) lib/gen_lsp.ex:292: GenLSP.attempt/3
    (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
```
2023-07-24 09:09:53 -07:00
..
2023-04-23 15:22:55 +02:00
2022-12-08 16:33:38 +01:00
2023-06-11 12:40:22 +01:00
2021-09-13 16:33:41 +02:00
2021-05-01 22:29:03 -04:00
2022-08-20 10:04:55 +02:00
2021-04-27 09:21:32 -04:00
2023-05-15 09:38:32 +02:00
2023-04-13 12:15:30 +02:00
2023-04-07 13:26:29 +02:00
2022-10-17 08:19:48 +02:00