mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Reduce visibility
This commit is contained in:
parent
ff0312fa32
commit
29832b8c3d
6 changed files with 26 additions and 29 deletions
|
@ -43,7 +43,7 @@ use crate::{
|
|||
completion::{
|
||||
CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
|
||||
},
|
||||
display::FunctionSignature,
|
||||
display::function_signature::FunctionSignature,
|
||||
};
|
||||
|
||||
pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext) {
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
completion_item::Builder, CompletionContext, CompletionItem, CompletionItemKind,
|
||||
CompletionKind, Completions,
|
||||
},
|
||||
display::{const_label, macro_label, type_label, FunctionSignature},
|
||||
display::{const_label, function_signature::FunctionSignature, macro_label, type_label},
|
||||
CompletionScore, RootDatabase,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! This module contains utilities for turning SyntaxNodes and HIR types
|
||||
//! into types that may be used to render in a UI.
|
||||
|
||||
mod function_signature;
|
||||
pub(crate) mod function_signature;
|
||||
mod navigation_target;
|
||||
mod structure;
|
||||
mod short_label;
|
||||
|
@ -11,7 +11,6 @@ use ra_syntax::{
|
|||
SyntaxKind::{ATTR, COMMENT},
|
||||
};
|
||||
|
||||
pub use function_signature::FunctionSignature;
|
||||
pub use navigation_target::NavigationTarget;
|
||||
pub use structure::{file_structure, StructureNode};
|
||||
|
||||
|
@ -19,7 +18,7 @@ pub(crate) use navigation_target::{ToNav, TryToNav};
|
|||
pub(crate) use short_label::ShortLabel;
|
||||
|
||||
pub(crate) fn function_label(node: &ast::FnDef) -> String {
|
||||
FunctionSignature::from(node).to_string()
|
||||
function_signature::FunctionSignature::from(node).to_string()
|
||||
}
|
||||
|
||||
pub(crate) fn const_label(node: &ast::ConstDef) -> String {
|
||||
|
|
|
@ -15,49 +15,48 @@ use stdx::{split_delim, SepBy};
|
|||
use crate::display::{generic_parameters, where_predicates};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum CallableKind {
|
||||
pub(crate) enum CallableKind {
|
||||
Function,
|
||||
StructConstructor,
|
||||
VariantConstructor,
|
||||
Macro,
|
||||
}
|
||||
|
||||
/// Contains information about a function signature
|
||||
#[derive(Debug)]
|
||||
pub struct FunctionSignature {
|
||||
pub kind: CallableKind,
|
||||
pub(crate) struct FunctionSignature {
|
||||
pub(crate) kind: CallableKind,
|
||||
/// Optional visibility
|
||||
pub visibility: Option<String>,
|
||||
pub(crate) visibility: Option<String>,
|
||||
/// Qualifiers like `async`, `unsafe`, ...
|
||||
pub qualifier: FunctionQualifier,
|
||||
pub(crate) qualifier: FunctionQualifier,
|
||||
/// Name of the function
|
||||
pub name: Option<String>,
|
||||
pub(crate) name: Option<String>,
|
||||
/// Documentation for the function
|
||||
pub doc: Option<Documentation>,
|
||||
pub(crate) doc: Option<Documentation>,
|
||||
/// Generic parameters
|
||||
pub generic_parameters: Vec<String>,
|
||||
pub(crate) generic_parameters: Vec<String>,
|
||||
/// Parameters of the function
|
||||
pub parameters: Vec<String>,
|
||||
pub(crate) parameters: Vec<String>,
|
||||
/// Parameter names of the function
|
||||
pub parameter_names: Vec<String>,
|
||||
pub(crate) parameter_names: Vec<String>,
|
||||
/// Parameter types of the function
|
||||
pub parameter_types: Vec<String>,
|
||||
pub(crate) parameter_types: Vec<String>,
|
||||
/// Optional return type
|
||||
pub ret_type: Option<String>,
|
||||
pub(crate) ret_type: Option<String>,
|
||||
/// Where predicates
|
||||
pub where_predicates: Vec<String>,
|
||||
pub(crate) where_predicates: Vec<String>,
|
||||
/// Self param presence
|
||||
pub has_self_param: bool,
|
||||
pub(crate) has_self_param: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct FunctionQualifier {
|
||||
pub(crate) struct FunctionQualifier {
|
||||
// `async` and `const` are mutually exclusive. Do we need to enforcing it here?
|
||||
pub is_async: bool,
|
||||
pub is_const: bool,
|
||||
pub is_unsafe: bool,
|
||||
pub(crate) is_async: bool,
|
||||
pub(crate) is_const: bool,
|
||||
pub(crate) is_unsafe: bool,
|
||||
/// The string `extern ".."`
|
||||
pub extern_abi: Option<String>,
|
||||
pub(crate) extern_abi: Option<String>,
|
||||
}
|
||||
|
||||
impl FunctionSignature {
|
||||
|
@ -277,7 +276,6 @@ impl Display for FunctionSignature {
|
|||
CallableKind::Function => write!(f, "fn {}", name)?,
|
||||
CallableKind::StructConstructor => write!(f, "struct {}", name)?,
|
||||
CallableKind::VariantConstructor => write!(f, "{}", name)?,
|
||||
CallableKind::Macro => write!(f, "{}!", name)?,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ use ra_syntax::{
|
|||
ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner},
|
||||
match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T,
|
||||
};
|
||||
|
||||
use crate::{FileId, FunctionSignature};
|
||||
use stdx::to_lower_snake_case;
|
||||
|
||||
use crate::{display::function_signature::FunctionSignature, FileId};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct InlayHintsConfig {
|
||||
pub type_hints: bool,
|
||||
|
|
|
@ -65,7 +65,7 @@ pub use crate::{
|
|||
CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat,
|
||||
},
|
||||
diagnostics::Severity,
|
||||
display::{file_structure, FunctionSignature, NavigationTarget, StructureNode},
|
||||
display::{file_structure, NavigationTarget, StructureNode},
|
||||
expand_macro::ExpandedMacro,
|
||||
folding_ranges::{Fold, FoldKind},
|
||||
hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult},
|
||||
|
|
Loading…
Reference in a new issue