diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-09 18:55:44 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-09 18:55:44 +0100 |
commit | 2fc2d4373b2c4e96bebf320a84270eee3afe34aa (patch) | |
tree | 5bdb33ae377b4004f0b28ec5e2edff71b41e8c4e /crates/ra_ide_api/src/lib.rs | |
parent | 5f700179fc7ed16d2848a6dbc7cf23da3b8df6c7 (diff) | |
parent | 45a2b9252401cc580dfa2e0e761313cc8334d47c (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.rs | 12 |
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 @@ | |||
13 | mod db; | 13 | mod db; |
14 | pub mod mock_analysis; | 14 | pub mod mock_analysis; |
15 | mod symbol_index; | 15 | mod symbol_index; |
16 | mod navigation_target; | ||
17 | mod change; | 16 | mod change; |
18 | 17 | ||
19 | mod status; | 18 | mod status; |
@@ -34,9 +33,9 @@ mod folding_ranges; | |||
34 | mod line_index; | 33 | mod line_index; |
35 | mod line_index_utils; | 34 | mod line_index_utils; |
36 | mod join_lines; | 35 | mod join_lines; |
37 | mod structure; | ||
38 | mod typing; | 36 | mod typing; |
39 | mod matching_brace; | 37 | mod matching_brace; |
38 | mod display; | ||
40 | 39 | ||
41 | #[cfg(test)] | 40 | #[cfg(test)] |
42 | mod marks; | 41 | mod 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 | ||
77 | pub use ra_db::{ | 75 | pub use ra_db::{ |
@@ -243,9 +241,7 @@ impl<T> RangeInfo<T> { | |||
243 | 241 | ||
244 | #[derive(Debug)] | 242 | #[derive(Debug)] |
245 | pub struct CallInfo { | 243 | pub 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. |