zed/crates/proto
Kirill Bulatov ed61abb8b8
Resolve completion items once exactly (#22448)
Closes https://github.com/zed-industries/zed/issues/19214
Closes https://github.com/zed-industries/zed/pull/22443

Adds `resolved` property into Zed completion item data, to ensure we
resolve every completion item exactly once.

There are 2 paths for singplayer Zed, and corresponding 2 analogues for
multi player code, where resolve may happen:
* completions menu display & selection, that ends up using
`resolve_completions` in `lsp_store.rs`
* applying a completion menu entry, that ends up using
`apply_additional_edits_for_completion` in `lsp_store.rs`

Now, all local counterparts check `enabled` field before resolving and
set it to true afterwards, and reuse the same `resolve_completion_local`
method for resolving the items.

A logic for re-generating docs and item labels was moved out from the
`resolve_completion_local` method into a separate method, as
`apply_additional_edits_for_completion` does not need that, but needs
the rest of the logic for resolving.
During the extraction, I've noted that multiplayer clients are not
getting the item labels, regenerated after the resolve — as the Zed
protocol-based flow is not the exact copy of the local resolving.
To improve that, `resolve_completion_remote` needs to be adjusted, but
this change is omitted to avoid bloating the PR.

Release Notes:

- Fixed autocomplete inserting multiple imports
2024-12-27 16:43:01 +00:00
..
proto Resolve completion items once exactly (#22448) 2024-12-27 16:43:01 +00:00
src Start to split out initialization and registration (#21787) 2024-12-11 14:05:10 -07:00
build.rs Allow rpc_url to be assigned on Client with test-support feature (#13430) 2024-07-10 13:36:22 -06:00
Cargo.toml Move ProtoClient to RPC crate, behind feature flag disabled in collab (#17908) 2024-09-16 14:50:30 -07:00
LICENSE-GPL Add missing LICENSE file to proto crate (#12863) 2024-06-10 15:35:37 -04:00