aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/item.rs
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-11-14 12:50:57 +0000
committerKirill Bulatov <[email protected]>2020-11-16 19:19:06 +0000
commitbbe1fbd1786b416908d3c6bc34c8cf805b39b761 (patch)
treedd11219a9e5d2f48d7c6e28e0f6554ccff5c0096 /crates/completion/src/item.rs
parent38ef1fd4ad7fd26439201a1a4147a7d90a13601f (diff)
Qualify autoimport completion suggestions
Diffstat (limited to 'crates/completion/src/item.rs')
-rw-r--r--crates/completion/src/item.rs24
1 files changed, 20 insertions, 4 deletions
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs
index 53a12a763..24b9d036a 100644
--- a/crates/completion/src/item.rs
+++ b/crates/completion/src/item.rs
@@ -202,6 +202,26 @@ impl CompletionItem {
202 ref_match: None, 202 ref_match: None,
203 } 203 }
204 } 204 }
205
206 pub(crate) fn into_builder(self) -> Builder {
207 Builder {
208 source_range: self.source_range,
209 completion_kind: self.completion_kind,
210 label: self.label,
211 insert_text: None,
212 insert_text_format: self.insert_text_format,
213 detail: self.detail,
214 documentation: self.documentation,
215 lookup: self.lookup,
216 kind: self.kind,
217 text_edit: Some(self.text_edit),
218 deprecated: Some(self.deprecated),
219 trigger_call_info: Some(self.trigger_call_info),
220 score: self.score,
221 ref_match: self.ref_match,
222 }
223 }
224
205 /// What user sees in pop-up in the UI. 225 /// What user sees in pop-up in the UI.
206 pub fn label(&self) -> &str { 226 pub fn label(&self) -> &str {
207 &self.label 227 &self.label
@@ -218,10 +238,6 @@ impl CompletionItem {
218 &self.text_edit 238 &self.text_edit
219 } 239 }
220 240
221 pub fn update_text_edit(&mut self, new_text_edit: TextEdit) {
222 self.text_edit = new_text_edit;
223 }
224
225 /// Short one-line additional information, like a type 241 /// Short one-line additional information, like a type
226 pub fn detail(&self) -> Option<&str> { 242 pub fn detail(&self) -> Option<&str> {
227 self.detail.as_deref() 243 self.detail.as_deref()