Kirill Bulatov
75c5344754
Fix completion labels becoming overly large due to LSP completion items with newlines (#23407)
Reworks https://github.com/zed-industries/zed/pull/23030 and
https://github.com/zed-industries/zed/pull/15087
Closes https://github.com/zed-industries/zed/issues/23352
Closes https://github.com/zed-industries/zed/issues/23310
Zed's completion items use `label` from LSP completion items as a base
to show in the list:
https://github.com/zed-industries/zed/blob/d290da7dac922fdc67c4774cdd371fba23fe62e3/crates/project/src/lsp_store.rs#L4371-L4374
Besides that, certain language plugins append `detail` or
`label_details.description` as a suffix:
https://github.com/zed-industries/zed/blob/d290da7dac922fdc67c4774cdd371fba23fe62e3/crates/languages/src/vtsls.rs#L178-L188
Either of these 3 properties may return `\n` (or multiple) in it,
spoiling Zed's completion menu, which uses `UniformList` to render those
items: a uniform list uses common, minimum possible height for each
element, and `\n` bloats that overly.
Good approach would be to use something else:
https://github.com/zed-industries/zed/issues/21403 but that has its own
drawbacks and relatively hard to use instead (?).
We could follow VSCode's approach and move away all but `label` from
`CodeLabel.text` to the side, where the documentation is, but that does
not solve the issue with `details` having newlines.
So, for now, sanitize all labels and remove any newlines from them. If
newlines are found, also replace whitespace sequences if there's more
than 1 in a row.
Later, this approach can be improved similarly to how Helix and Zed's
inline completions do: rendering a "ghost" text, showing the
completion's edit applied to the editor.
Release Notes:
- Fixed completion labels becoming overly large due to LSP completion
items with newlines
2025-01-21 17:55:41 +02:00
..
2025-01-17 17:39:22 +01:00
2025-01-20 13:19:15 -05:00
2025-01-17 17:39:22 +01:00
2025-01-18 21:50:07 +00:00
2025-01-20 21:33:18 -05:00
2025-01-17 17:39:22 +01:00
2025-01-20 21:33:18 -05:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:57:17 +02:00
2025-01-18 22:57:17 +02:00
2025-01-17 17:39:22 +01:00
2025-01-20 11:48:49 -03:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:27:08 +00:00
2025-01-18 22:57:17 +02:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:27:08 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-20 23:20:15 +00:00
2025-01-21 17:55:41 +02:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-21 14:19:23 +08:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-20 13:57:19 -05:00
2025-01-17 17:39:22 +01:00
2025-01-20 16:00:47 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-20 23:20:15 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:57:13 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-20 11:48:49 -03:00
2025-01-20 19:11:13 -03:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-21 17:55:41 +02:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:27:08 +00:00
2025-01-21 17:55:41 +02:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 15:06:10 -07:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:27:08 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-21 17:55:41 +02:00
2025-01-21 11:13:46 -03:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:57:17 +02:00
2025-01-18 17:36:41 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-21 12:48:40 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-21 07:14:46 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:27:08 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-20 14:15:25 +02:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-18 17:36:41 +01:00
2025-01-18 17:36:41 +01:00
2025-01-17 17:39:22 +01:00
2025-01-21 11:13:46 -03:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-20 23:20:15 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-21 07:14:46 +00:00
2025-01-17 17:39:22 +01:00
2025-01-18 22:27:08 +00:00
2025-01-17 17:39:22 +01:00
2025-01-17 17:39:22 +01:00
2025-01-20 11:34:18 +00:00
2025-01-21 14:19:23 +08:00
2025-01-21 07:14:46 +00:00
2025-01-17 17:39:22 +01:00
2025-01-20 11:48:49 -03:00
2025-01-20 11:48:49 -03:00