aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/item.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-22 15:59:22 +0000
committerAleksey Kladov <[email protected]>2021-01-22 16:15:34 +0000
commita40f78f92ad2050d6178dfd70374701c6bc826ae (patch)
treebd1b08a23eeaecea0b2413454cca2ca0c6631bfe /crates/completion/src/item.rs
parent02a17cdffcfdea49981b4642be3027e564d28d9b (diff)
More useful fn detail in completion
Detail should be rendered as shtort one line, just dumping fn header there is not useful, despite the fact that TS does this. The fact that this is a function should be indicated by the icon, the same goes for pub/const/async etc qualitfiers name is already present in the lable (and arg list should be a part of that, as in idea) But the return type is the small genuinerlly useful bit of info we can show here
Diffstat (limited to 'crates/completion/src/item.rs')
-rw-r--r--crates/completion/src/item.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs
index d2e6a6aeb..eeb952ec3 100644
--- a/crates/completion/src/item.rs
+++ b/crates/completion/src/item.rs
@@ -398,14 +398,13 @@ impl Builder {
398 self.insert_text_format = InsertTextFormat::Snippet; 398 self.insert_text_format = InsertTextFormat::Snippet;
399 self.text_edit(edit) 399 self.text_edit(edit)
400 } 400 }
401 #[allow(unused)]
402 pub(crate) fn detail(self, detail: impl Into<String>) -> Builder { 401 pub(crate) fn detail(self, detail: impl Into<String>) -> Builder {
403 self.set_detail(Some(detail)) 402 self.set_detail(Some(detail))
404 } 403 }
405 pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder { 404 pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder {
406 self.detail = detail.map(Into::into); 405 self.detail = detail.map(Into::into);
407 if let Some(detail) = &self.detail { 406 if let Some(detail) = &self.detail {
408 if assert_never!(detail.contains('\n'), "multiline detail: {}", detail) { 407 if assert_never!(detail.contains('\n'), "multiline detail:\n{}", detail) {
409 self.detail = Some(detail.splitn(2, '\n').next().unwrap().to_string()); 408 self.detail = Some(detail.splitn(2, '\n').next().unwrap().to_string());
410 } 409 }
411 } 410 }