aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 18:55:44 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 18:55:44 +0100
commit2fc2d4373b2c4e96bebf320a84270eee3afe34aa (patch)
tree5bdb33ae377b4004f0b28ec5e2edff71b41e8c4e /crates/ra_ide_api/src/lib.rs
parent5f700179fc7ed16d2848a6dbc7cf23da3b8df6c7 (diff)
parent45a2b9252401cc580dfa2e0e761313cc8334d47c (diff)
Merge #1110
1110: Introduce display module and implement new FunctionSignature for CallInfo's r=matklad a=vipentti This introduces a new module `display` in `ra_ide_api` that contains UI-related things, in addition this refactors CallInfo's function signatures into a new `FunctionSignature` type, which implements `Display` and can be converted into `lsp_types::SignatureInformation` in the `conv` layer. Currently only `CallInfo` uses the `FunctionSignature` directly, but `function_label` now uses the same signature and returns it as a string, using the `Display` implementation. This also fixes #960 I think this similar structure could be applied to other UI-displayable items, so instead of the `ra_ide_api` returning `Strings` we could return some intermediate structures that can be converted into a UI-displayable `String` easily, but that could also provide some additional information. Co-authored-by: Ville Penttinen <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r--crates/ra_ide_api/src/lib.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 9063f78a9..d25795adc 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -13,7 +13,6 @@
13mod db; 13mod db;
14pub mod mock_analysis; 14pub mod mock_analysis;
15mod symbol_index; 15mod symbol_index;
16mod navigation_target;
17mod change; 16mod change;
18 17
19mod status; 18mod status;
@@ -34,9 +33,9 @@ mod folding_ranges;
34mod line_index; 33mod line_index;
35mod line_index_utils; 34mod line_index_utils;
36mod join_lines; 35mod join_lines;
37mod structure;
38mod typing; 36mod typing;
39mod matching_brace; 37mod matching_brace;
38mod display;
40 39
41#[cfg(test)] 40#[cfg(test)]
42mod marks; 41mod marks;
@@ -62,7 +61,6 @@ pub use crate::{
62 change::{AnalysisChange, LibraryData}, 61 change::{AnalysisChange, LibraryData},
63 completion::{CompletionItem, CompletionItemKind, InsertTextFormat}, 62 completion::{CompletionItem, CompletionItemKind, InsertTextFormat},
64 runnables::{Runnable, RunnableKind}, 63 runnables::{Runnable, RunnableKind},
65 navigation_target::NavigationTarget,
66 references::ReferenceSearchResult, 64 references::ReferenceSearchResult,
67 assists::{Assist, AssistId}, 65 assists::{Assist, AssistId},
68 hover::{HoverResult}, 66 hover::{HoverResult},
@@ -70,8 +68,8 @@ pub use crate::{
70 line_index_utils::translate_offset_with_edit, 68 line_index_utils::translate_offset_with_edit,
71 folding_ranges::{Fold, FoldKind}, 69 folding_ranges::{Fold, FoldKind},
72 syntax_highlighting::HighlightedRange, 70 syntax_highlighting::HighlightedRange,
73 structure::{StructureNode, file_structure},
74 diagnostics::Severity, 71 diagnostics::Severity,
72 display::{FunctionSignature, NavigationTarget, StructureNode, file_structure},
75}; 73};
76 74
77pub use ra_db::{ 75pub use ra_db::{
@@ -243,9 +241,7 @@ impl<T> RangeInfo<T> {
243 241
244#[derive(Debug)] 242#[derive(Debug)]
245pub struct CallInfo { 243pub struct CallInfo {
246 pub label: String, 244 pub signature: FunctionSignature,
247 pub doc: Option<Documentation>,
248 pub parameters: Vec<String>,
249 pub active_parameter: Option<usize>, 245 pub active_parameter: Option<usize>,
250} 246}
251 247
@@ -387,7 +383,7 @@ impl Analysis {
387 /// file outline. 383 /// file outline.
388 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { 384 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
389 let file = self.db.parse(file_id); 385 let file = self.db.parse(file_id);
390 structure::file_structure(&file) 386 file_structure(&file)
391 } 387 }
392 388
393 /// Returns the set of folding ranges. 389 /// Returns the set of folding ranges.