diff options
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index c892ad846..672c7ed0e 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -15,6 +15,7 @@ pub struct CompletionItem { | |||
15 | label: String, | 15 | label: String, |
16 | kind: Option<CompletionItemKind>, | 16 | kind: Option<CompletionItemKind>, |
17 | detail: Option<String>, | 17 | detail: Option<String>, |
18 | documentation: Option<String>, | ||
18 | lookup: Option<String>, | 19 | lookup: Option<String>, |
19 | insert_text: Option<String>, | 20 | insert_text: Option<String>, |
20 | insert_text_format: InsertTextFormat, | 21 | insert_text_format: InsertTextFormat, |
@@ -77,6 +78,7 @@ impl CompletionItem { | |||
77 | insert_text: None, | 78 | insert_text: None, |
78 | insert_text_format: InsertTextFormat::PlainText, | 79 | insert_text_format: InsertTextFormat::PlainText, |
79 | detail: None, | 80 | detail: None, |
81 | documentation: None, | ||
80 | lookup: None, | 82 | lookup: None, |
81 | kind: None, | 83 | kind: None, |
82 | text_edit: None, | 84 | text_edit: None, |
@@ -90,6 +92,10 @@ impl CompletionItem { | |||
90 | pub fn detail(&self) -> Option<&str> { | 92 | pub fn detail(&self) -> Option<&str> { |
91 | self.detail.as_ref().map(|it| it.as_str()) | 93 | self.detail.as_ref().map(|it| it.as_str()) |
92 | } | 94 | } |
95 | /// A doc-comment | ||
96 | pub fn documentation(&self) -> Option<&str> { | ||
97 | self.documentation.as_ref().map(|it| it.as_str()) | ||
98 | } | ||
93 | /// What string is used for filtering. | 99 | /// What string is used for filtering. |
94 | pub fn lookup(&self) -> &str { | 100 | pub fn lookup(&self) -> &str { |
95 | self.lookup | 101 | self.lookup |
@@ -127,6 +133,7 @@ pub(crate) struct Builder { | |||
127 | insert_text: Option<String>, | 133 | insert_text: Option<String>, |
128 | insert_text_format: InsertTextFormat, | 134 | insert_text_format: InsertTextFormat, |
129 | detail: Option<String>, | 135 | detail: Option<String>, |
136 | documentation: Option<String>, | ||
130 | lookup: Option<String>, | 137 | lookup: Option<String>, |
131 | kind: Option<CompletionItemKind>, | 138 | kind: Option<CompletionItemKind>, |
132 | text_edit: Option<TextEdit>, | 139 | text_edit: Option<TextEdit>, |
@@ -142,6 +149,7 @@ impl Builder { | |||
142 | source_range: self.source_range, | 149 | source_range: self.source_range, |
143 | label: self.label, | 150 | label: self.label, |
144 | detail: self.detail, | 151 | detail: self.detail, |
152 | documentation: self.documentation, | ||
145 | insert_text_format: self.insert_text_format, | 153 | insert_text_format: self.insert_text_format, |
146 | lookup: self.lookup, | 154 | lookup: self.lookup, |
147 | kind: self.kind, | 155 | kind: self.kind, |
@@ -184,6 +192,14 @@ impl Builder { | |||
184 | self.detail = detail.map(Into::into); | 192 | self.detail = detail.map(Into::into); |
185 | self | 193 | self |
186 | } | 194 | } |
195 | #[allow(unused)] | ||
196 | pub(crate) fn documentation(self, docs: impl Into<String>) -> Builder { | ||
197 | self.set_documentation(Some(docs)) | ||
198 | } | ||
199 | pub(crate) fn set_documentation(mut self, docs: Option<impl Into<String>>) -> Builder { | ||
200 | self.documentation = docs.map(Into::into); | ||
201 | self | ||
202 | } | ||
187 | pub(super) fn from_resolution( | 203 | pub(super) fn from_resolution( |
188 | mut self, | 204 | mut self, |
189 | ctx: &CompletionContext, | 205 | ctx: &CompletionContext, |