[ty] Add type as detail to completion items (#20047)

## Summary

@BurntSushi was so kind as to find me an easy task to do some coding
before I'm off to PTO.

This PR adds the type to completion items (see the gray little text at
the end of a completion item).



https://github.com/user-attachments/assets/c0a86061-fa12-47b4-b43c-3c646771a69d
This commit is contained in:
Micha Reiser 2025-08-22 18:32:53 +02:00 committed by GitHub
parent 0b6ce1c788
commit 5d217b7f46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 0 deletions

View file

@ -71,6 +71,7 @@ impl BackgroundDocumentRequestHandler for CompletionRequestHandler {
label: comp.inner.name.into(),
kind,
sort_text: Some(format!("{i:-max_index_len$}")),
detail: comp.inner.ty.display(db).to_string().into(),
documentation: comp
.documentation
.map(|docstring| Documentation::String(docstring.render_plaintext())),