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