diff --git a/crates/ty_server/src/server/api/requests/completion.rs b/crates/ty_server/src/server/api/requests/completion.rs index 214c04582f..e175ed49fe 100644 --- a/crates/ty_server/src/server/api/requests/completion.rs +++ b/crates/ty_server/src/server/api/requests/completion.rs @@ -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())), diff --git a/crates/ty_wasm/src/lib.rs b/crates/ty_wasm/src/lib.rs index f835ea9112..413699866a 100644 --- a/crates/ty_wasm/src/lib.rs +++ b/crates/ty_wasm/src/lib.rs @@ -425,6 +425,7 @@ impl Workspace { documentation: completion .documentation .map(|documentation| documentation.render_plaintext()), + detail: completion.inner.ty.display(&self.db).to_string().into(), }) .collect()) } @@ -914,6 +915,8 @@ pub struct Completion { pub kind: Option, #[wasm_bindgen(getter_with_clone)] pub documentation: Option, + #[wasm_bindgen(getter_with_clone)] + pub detail: Option, } #[wasm_bindgen] diff --git a/playground/ty/src/Editor/Editor.tsx b/playground/ty/src/Editor/Editor.tsx index 5abcba0705..75bcf9d119 100644 --- a/playground/ty/src/Editor/Editor.tsx +++ b/playground/ty/src/Editor/Editor.tsx @@ -321,6 +321,7 @@ class PlaygroundServer : mapCompletionKind(completion.kind), insertText: completion.name, documentation: completion.documentation, + detail: completion.detail, // TODO(micha): It's unclear why this field is required for monaco but not VS Code. // and omitting it works just fine? The LSP doesn't expose this information right now // which is why we go with undefined for now.