aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/lib.rs
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-03-12 07:24:46 +0000
committerVille Penttinen <[email protected]>2019-04-09 12:45:04 +0100
commit0e49abb7fbe9239b97f0b7168ec359014c63f8c0 (patch)
treeb76168a2cf9f09336e446dcc584879a918681055 /crates/ra_ide_api/src/lib.rs
parent5f700179fc7ed16d2848a6dbc7cf23da3b8df6c7 (diff)
Refactor CallInfo function signatures to new FunctionSignature type
This is used by CallInfo to create a pretty printed function signature that can be used with completions and other places as well.
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r--crates/ra_ide_api/src/lib.rs29
1 files changed, 27 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 9063f78a9..7f8f454bc 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -37,6 +37,7 @@ mod join_lines;
37mod structure; 37mod structure;
38mod typing; 38mod typing;
39mod matching_brace; 39mod matching_brace;
40mod display;
40 41
41#[cfg(test)] 42#[cfg(test)]
42mod marks; 43mod marks;
@@ -243,10 +244,34 @@ impl<T> RangeInfo<T> {
243 244
244#[derive(Debug)] 245#[derive(Debug)]
245pub struct CallInfo { 246pub struct CallInfo {
246 pub label: String, 247 pub signature: FunctionSignature,
248 pub active_parameter: Option<usize>,
249}
250
251/// Contains information about a function signature
252#[derive(Debug)]
253pub struct FunctionSignature {
254 /// Optional visibility
255 pub visibility: Option<String>,
256 /// Name of the function
257 pub name: Option<String>,
258 /// Documentation for the function
247 pub doc: Option<Documentation>, 259 pub doc: Option<Documentation>,
260 /// Generic parameters
261 pub generic_parameters: Vec<String>,
262 /// Parameters of the function
248 pub parameters: Vec<String>, 263 pub parameters: Vec<String>,
249 pub active_parameter: Option<usize>, 264 /// Optional return type
265 pub ret_type: Option<String>,
266 /// Where predicates
267 pub where_predicates: Vec<String>,
268}
269
270impl FunctionSignature {
271 pub(crate) fn with_doc_opt(mut self, doc: Option<Documentation>) -> Self {
272 self.doc = doc;
273 self
274 }
250} 275}
251 276
252/// `AnalysisHost` stores the current state of the world. 277/// `AnalysisHost` stores the current state of the world.