aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs2
-rw-r--r--crates/ra_ide/src/completion/presentation.rs2
-rw-r--r--crates/ra_ide/src/display.rs5
-rw-r--r--crates/ra_ide/src/display/function_signature.rs40
-rw-r--r--crates/ra_ide/src/inlay_hints.rs4
-rw-r--r--crates/ra_ide/src/lib.rs2
6 files changed, 26 insertions, 29 deletions
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs
index a610fd6d1..90f5b1c25 100644
--- a/crates/ra_ide/src/completion/complete_trait_impl.rs
+++ b/crates/ra_ide/src/completion/complete_trait_impl.rs
@@ -43,7 +43,7 @@ use crate::{
43 completion::{ 43 completion::{
44 CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions, 44 CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
45 }, 45 },
46 display::FunctionSignature, 46 display::function_signature::FunctionSignature,
47}; 47};
48 48
49pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext) { 49pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext) {
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index e6b4737aa..e29b82017 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -11,7 +11,7 @@ use crate::{
11 completion_item::Builder, CompletionContext, CompletionItem, CompletionItemKind, 11 completion_item::Builder, CompletionContext, CompletionItem, CompletionItemKind,
12 CompletionKind, Completions, 12 CompletionKind, Completions,
13 }, 13 },
14 display::{const_label, macro_label, type_label, FunctionSignature}, 14 display::{const_label, function_signature::FunctionSignature, macro_label, type_label},
15 CompletionScore, RootDatabase, 15 CompletionScore, RootDatabase,
16}; 16};
17 17
diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs
index 70d2a2dd1..b59d4bbdf 100644
--- a/crates/ra_ide/src/display.rs
+++ b/crates/ra_ide/src/display.rs
@@ -1,7 +1,7 @@
1//! This module contains utilities for turning SyntaxNodes and HIR types 1//! This module contains utilities for turning SyntaxNodes and HIR types
2//! into types that may be used to render in a UI. 2//! into types that may be used to render in a UI.
3 3
4mod function_signature; 4pub(crate) mod function_signature;
5mod navigation_target; 5mod navigation_target;
6mod structure; 6mod structure;
7mod short_label; 7mod short_label;
@@ -11,7 +11,6 @@ use ra_syntax::{
11 SyntaxKind::{ATTR, COMMENT}, 11 SyntaxKind::{ATTR, COMMENT},
12}; 12};
13 13
14pub use function_signature::FunctionSignature;
15pub use navigation_target::NavigationTarget; 14pub use navigation_target::NavigationTarget;
16pub use structure::{file_structure, StructureNode}; 15pub use structure::{file_structure, StructureNode};
17 16
@@ -19,7 +18,7 @@ pub(crate) use navigation_target::{ToNav, TryToNav};
19pub(crate) use short_label::ShortLabel; 18pub(crate) use short_label::ShortLabel;
20 19
21pub(crate) fn function_label(node: &ast::FnDef) -> String { 20pub(crate) fn function_label(node: &ast::FnDef) -> String {
22 FunctionSignature::from(node).to_string() 21 function_signature::FunctionSignature::from(node).to_string()
23} 22}
24 23
25pub(crate) fn const_label(node: &ast::ConstDef) -> String { 24pub(crate) fn const_label(node: &ast::ConstDef) -> String {
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs
index 709a85f65..9b7220d1f 100644
--- a/crates/ra_ide/src/display/function_signature.rs
+++ b/crates/ra_ide/src/display/function_signature.rs
@@ -15,49 +15,48 @@ use stdx::{split_delim, SepBy};
15use crate::display::{generic_parameters, where_predicates}; 15use crate::display::{generic_parameters, where_predicates};
16 16
17#[derive(Debug)] 17#[derive(Debug)]
18pub enum CallableKind { 18pub(crate) enum CallableKind {
19 Function, 19 Function,
20 StructConstructor, 20 StructConstructor,
21 VariantConstructor, 21 VariantConstructor,
22 Macro,
23} 22}
24 23
25/// Contains information about a function signature 24/// Contains information about a function signature
26#[derive(Debug)] 25#[derive(Debug)]
27pub struct FunctionSignature { 26pub(crate) struct FunctionSignature {
28 pub kind: CallableKind, 27 pub(crate) kind: CallableKind,
29 /// Optional visibility 28 /// Optional visibility
30 pub visibility: Option<String>, 29 pub(crate) visibility: Option<String>,
31 /// Qualifiers like `async`, `unsafe`, ... 30 /// Qualifiers like `async`, `unsafe`, ...
32 pub qualifier: FunctionQualifier, 31 pub(crate) qualifier: FunctionQualifier,
33 /// Name of the function 32 /// Name of the function
34 pub name: Option<String>, 33 pub(crate) name: Option<String>,
35 /// Documentation for the function 34 /// Documentation for the function
36 pub doc: Option<Documentation>, 35 pub(crate) doc: Option<Documentation>,
37 /// Generic parameters 36 /// Generic parameters
38 pub generic_parameters: Vec<String>, 37 pub(crate) generic_parameters: Vec<String>,
39 /// Parameters of the function 38 /// Parameters of the function
40 pub parameters: Vec<String>, 39 pub(crate) parameters: Vec<String>,
41 /// Parameter names of the function 40 /// Parameter names of the function
42 pub parameter_names: Vec<String>, 41 pub(crate) parameter_names: Vec<String>,
43 /// Parameter types of the function 42 /// Parameter types of the function
44 pub parameter_types: Vec<String>, 43 pub(crate) parameter_types: Vec<String>,
45 /// Optional return type 44 /// Optional return type
46 pub ret_type: Option<String>, 45 pub(crate) ret_type: Option<String>,
47 /// Where predicates 46 /// Where predicates
48 pub where_predicates: Vec<String>, 47 pub(crate) where_predicates: Vec<String>,
49 /// Self param presence 48 /// Self param presence
50 pub has_self_param: bool, 49 pub(crate) has_self_param: bool,
51} 50}
52 51
53#[derive(Debug, Default)] 52#[derive(Debug, Default)]
54pub struct FunctionQualifier { 53pub(crate) struct FunctionQualifier {
55 // `async` and `const` are mutually exclusive. Do we need to enforcing it here? 54 // `async` and `const` are mutually exclusive. Do we need to enforcing it here?
56 pub is_async: bool, 55 pub(crate) is_async: bool,
57 pub is_const: bool, 56 pub(crate) is_const: bool,
58 pub is_unsafe: bool, 57 pub(crate) is_unsafe: bool,
59 /// The string `extern ".."` 58 /// The string `extern ".."`
60 pub extern_abi: Option<String>, 59 pub(crate) extern_abi: Option<String>,
61} 60}
62 61
63impl FunctionSignature { 62impl FunctionSignature {
@@ -277,7 +276,6 @@ impl Display for FunctionSignature {
277 CallableKind::Function => write!(f, "fn {}", name)?, 276 CallableKind::Function => write!(f, "fn {}", name)?,
278 CallableKind::StructConstructor => write!(f, "struct {}", name)?, 277 CallableKind::StructConstructor => write!(f, "struct {}", name)?,
279 CallableKind::VariantConstructor => write!(f, "{}", name)?, 278 CallableKind::VariantConstructor => write!(f, "{}", name)?,
280 CallableKind::Macro => write!(f, "{}!", name)?,
281 } 279 }
282 } 280 }
283 281
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 2e021f032..ae5695f61 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -5,10 +5,10 @@ use ra_syntax::{
5 ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, 5 ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner},
6 match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, 6 match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T,
7}; 7};
8
9use crate::{FileId, FunctionSignature};
10use stdx::to_lower_snake_case; 8use stdx::to_lower_snake_case;
11 9
10use crate::{display::function_signature::FunctionSignature, FileId};
11
12#[derive(Clone, Debug, PartialEq, Eq)] 12#[derive(Clone, Debug, PartialEq, Eq)]
13pub struct InlayHintsConfig { 13pub struct InlayHintsConfig {
14 pub type_hints: bool, 14 pub type_hints: bool,
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index 5d1f64e19..6810c1c6a 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -65,7 +65,7 @@ pub use crate::{
65 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, 65 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat,
66 }, 66 },
67 diagnostics::Severity, 67 diagnostics::Severity,
68 display::{file_structure, FunctionSignature, NavigationTarget, StructureNode}, 68 display::{file_structure, NavigationTarget, StructureNode},
69 expand_macro::ExpandedMacro, 69 expand_macro::ExpandedMacro,
70 folding_ranges::{Fold, FoldKind}, 70 folding_ranges::{Fold, FoldKind},
71 hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, 71 hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult},