mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Inline PathQualifierCtx
This commit is contained in:
parent
d6f161ffa9
commit
85b68b1f7d
10 changed files with 39 additions and 48 deletions
|
@ -64,6 +64,8 @@ pub(crate) struct PathCompletionCtx {
|
|||
pub(super) kind: PathKind,
|
||||
/// Whether the path segment has type args or not.
|
||||
pub(super) has_type_args: bool,
|
||||
/// Whether the qualifier comes from a use tree parent or not
|
||||
pub(crate) use_tree_parent: bool,
|
||||
}
|
||||
|
||||
impl PathCompletionCtx {
|
||||
|
@ -149,24 +151,18 @@ pub(super) enum ItemListKind {
|
|||
#[derive(Debug)]
|
||||
pub(super) enum Qualified {
|
||||
No,
|
||||
With(PathQualifierCtx),
|
||||
With {
|
||||
path: ast::Path,
|
||||
resolution: Option<PathResolution>,
|
||||
/// Whether this path consists solely of `super` segments
|
||||
is_super_chain: bool,
|
||||
},
|
||||
/// <_>::
|
||||
Infer,
|
||||
/// Whether the path is an absolute path
|
||||
Absolute,
|
||||
}
|
||||
|
||||
/// The path qualifier state of the path we are completing.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct PathQualifierCtx {
|
||||
pub(crate) path: ast::Path,
|
||||
pub(crate) resolution: Option<PathResolution>,
|
||||
/// Whether this path consists solely of `super` segments
|
||||
pub(crate) is_super_chain: bool,
|
||||
/// Whether the qualifier comes from a use tree parent or not
|
||||
pub(crate) use_tree_parent: bool,
|
||||
}
|
||||
|
||||
/// The state of the pattern we are completing.
|
||||
#[derive(Debug)]
|
||||
pub(super) struct PatternContext {
|
||||
|
@ -410,7 +406,7 @@ impl<'a> CompletionContext<'a> {
|
|||
|
||||
pub(crate) fn path_qual(&self) -> Option<&ast::Path> {
|
||||
self.path_context().and_then(|it| match &it.qualified {
|
||||
Qualified::With(it) => Some(&it.path),
|
||||
Qualified::With { path, .. } => Some(path),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue