lsp: Use itemDefaults if sent along with completion items (#11902)
This fixes #10532 by properly making use of `itemDefaults.data` when that is sent along next to completion `items`. With this line here we tell the language server that we support `data` in `itemDefaults`, but we actually never checked for it and never used it: https://github.com/zed-industries/zed/blob/a0d7ec9f8e70799163313767b5a8bc34d9e4aa1b/crates/lsp/src/lsp.rs#L653 In the case of `tailwindcss-language-server` that means that most of the items it returns (more than 10k items!) were missing the `data` attribute, since the language server thought it can send it along in the `itemDefaults` (because we advertised our capability to use it.) When we then did a `completionItem/resolve`, we would not send a `data` attribute along, which lead to an error on the `tailwindcss-language-server` side and thus no documentation. This PR also adds support for the other `itemDefaults` that could be sent along and that we say we support: https://github.com/zed-industries/zed/blob/a0d7ec9f8e70799163313767b5a8bc34d9e4aa1b/crates/lsp/src/lsp.rs#L650-L653 `editRange` we handle separately, so this PR only adds the other 3. Release Notes: - Fixed documentation not showing up for completion items coming from `tailwindcss-language-server`. ([#10532](https://github.com/zed-industries/zed/issues/10532)). Demo: https://github.com/zed-industries/zed/assets/1185253/bc5ea0b3-7d83-499f-a908-b0d2a1db8a41
T
Thorsten Ball committed
8c681d0db3b804faa7167b02e748d7a526966edb
Parent: 9969d6c
Committed by GitHub <noreply@github.com>
on 5/16/2024, 11:26:07 AM