# lsp: Use itemDefaults if sent along with completion items \(\#11902\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8c681d0db3b804faa7167b02e748d7a526966edb)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8c681d0db3b804faa7167b02e748d7a526966edb

Requested commit: 8c681d0db3b804faa7167b02e748d7a526966edb

Commit: 8c681d0db3b804faa7167b02e748d7a526966edb

Tree: 4c9c8aaef60bc504fa0af7a2104e346a99edebfc

Author: Thorsten Ball

Committer: GitHub

## Message

```
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
```

## Parents

- [9969d6c702c64823787e88ccd104a2068dcd6d81](https://git.cafe/gitcafe/zed/commit/9969d6c702c64823787e88ccd104a2068dcd6d81?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8c681d0db3b804faa7167b02e748d7a526966edb?format=markdown)
