[ty] Swap detail and description fields for CompletionItemLabelDetails#20466
[ty] Swap detail and description fields for CompletionItemLabelDetails#20466BurntSushi merged 1 commit intomainfrom
detail and description fields for CompletionItemLabelDetails#20466Conversation
|
Demo: 2025-09-18T08.26.54-04.00.mp4 |
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
Thanks for looking into this. It now seems unfortunate that the module name comes directly (without any space) after the completion text which seems expected acording to the LSP specification /**
* Additional details for a completion item label.
*
* @since 3.17.0
*/
export interface [CompletionItemLabelDetails](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemLabelDetails) {
/**
* An optional string which is rendered less prominently directly after
* {@link CompletionItem.label label}, without any spacing. Should be
* used for function signatures or type annotations.
*/
detail?: string;
/**
* An optional string which is rendered less prominently after
* {@link CompletionItemLabelDetails.detail}. Should be used for fully qualified
* names or file path.
*/
description?: string;
}I think we should at least insert a space at the front of Or we keep using Edit: I only just now saw your detailed write-up on the issue. I think what you did makes sense. I'm only wondering if we should introduce a space to make this look less squeezed together Edit2: It seems that r-a solves this visual issue by using |
|
…etails` This seems to be more consistent with how other LSPs work (like `rust-analyzer`), and also I think is more consistent with how `CompletionItem.detail` is itself rendered. Namely, in VS Code, it is right-aligned. And it's also where we put the type signature. But `CompletionItemLabelDetails.detail` is left-aligned where as `CompletionItemLabelDetails.description` is right-aligned. So let's swap them such that type signatures go in the latter and not the former. This also adds a space before the module name and contextualizes it with `(import <name>)` to help aide the end user in figuring out selecting the completion will do. Fixes #1200
265b038 to
421b24a
Compare
|
Yeah and r-a inserts a leading space too. I added the leading space and added Demo: 2025-09-18T08.47.29-04.00.mp4 |
This seems to be more consistent with how other LSPs work (like
rust-analyzer), and also I think is more consistent with howCompletionItem.detailis itself rendered. Namely, in VS Code, itis right-aligned. And it's also where we put the type signature.
But
CompletionItemLabelDetails.detailis left-aligned where asCompletionItemLabelDetails.descriptionis right-aligned. So let'sswap them such that type signatures go in the latter and not the
former.
Fixes astral-sh/ty#1200