# Avoid modifying the LSP message before resolving it \(\#26347\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8a7a78fafbd4c4ec643b32c44020b1256a96401c

Requested commit: 8a7a78fafbd4c4ec643b32c44020b1256a96401c

Commit: 8a7a78fafbd4c4ec643b32c44020b1256a96401c

Tree: 2b4e1b8f14121e4f81b4c46f612a9792d284fbd5

Author: Kirill Bulatov

Committer: GitHub

## Message

```
Avoid modifying the LSP message before resolving it (#26347)

Closes https://github.com/zed-industries/zed/issues/21277

To the left is current Zed, right is the improved version.
3rd message, from Zed, to resolve the item, does not have `textEdit` on
the right side, and has one on the left.
Seems to not influence the end result though, but at least Zed behaves
more appropriate now.

<img width="1727" alt="image"
src="https://github.com/user-attachments/assets/ca1236fd-9ce2-41ba-88fe-1f3178cdcbde"
/>


Instead of modifying the original LSP completion item, store completion
list defaults and apply them when the item is requested (except `data`
defaults, needed for resolve).

Now, the only place that can modify the completion items is this method,
and Python impl seems to be the one doing it:


https://github.com/zed-industries/zed/blob/ca9c3af56ffb05a789c2b946489f4406af2c8281/crates/languages/src/python.rs#L182-L204

Seems ok to leave untouched for now.

Release Notes:

- Fixed LSP completion items modified before resolve request
```

## Parents

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

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