Cleanup PathCompletionContext qualifier handling

This commit is contained in:
Lukas Wirth 2022-02-02 16:01:46 +01:00
parent a3ad99649f
commit 33fd2d7aef
10 changed files with 89 additions and 91 deletions

View file

@ -2,8 +2,6 @@
//! //!
//! This module uses a bit of static metadata to provide completions for builtin-in attributes and lints. //! This module uses a bit of static metadata to provide completions for builtin-in attributes and lints.
use std::iter;
use hir::ScopeDef; use hir::ScopeDef;
use ide_db::{ use ide_db::{
helpers::{ helpers::{
@ -24,7 +22,7 @@ use syntax::{
use crate::{ use crate::{
completions::module_or_attr, completions::module_or_attr,
context::{CompletionContext, PathCompletionContext, PathKind}, context::{CompletionContext, PathCompletionCtx, PathKind, PathQualifierCtx},
item::CompletionItem, item::CompletionItem,
Completions, Completions,
}; };
@ -76,25 +74,23 @@ pub(crate) fn complete_known_attribute_input(
} }
pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) { pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) {
let (is_trivial_path, qualifier, is_inner, annotated_item_kind) = match ctx.path_context { let (is_absolute_path, qualifier, is_inner, annotated_item_kind) = match ctx.path_context {
Some(PathCompletionContext { Some(PathCompletionCtx {
kind: Some(PathKind::Attr { kind, annotated_item_kind }), kind: Some(PathKind::Attr { kind, annotated_item_kind }),
is_trivial_path, is_absolute_path,
ref qualifier, ref qualifier,
.. ..
}) => (is_trivial_path, qualifier, kind == AttrKind::Inner, annotated_item_kind), }) => (is_absolute_path, qualifier, kind == AttrKind::Inner, annotated_item_kind),
_ => return, _ => return,
}; };
match qualifier { match qualifier {
Some((path, qualifier)) => { Some(PathQualifierCtx { resolution, is_super_chain, .. }) => {
let is_super_chain = iter::successors(Some(path.clone()), |p| p.qualifier()) if *is_super_chain {
.all(|p| p.segment().and_then(|s| s.super_token()).is_some());
if is_super_chain {
acc.add_keyword(ctx, "super::"); acc.add_keyword(ctx, "super::");
} }
let module = match qualifier { let module = match resolution {
Some(hir::PathResolution::Def(hir::ModuleDef::Module(it))) => it, Some(hir::PathResolution::Def(hir::ModuleDef::Module(it))) => it,
_ => return, _ => return,
}; };
@ -107,7 +103,7 @@ pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext)
return; return;
} }
// fresh use tree with leading colon2, only show crate roots // fresh use tree with leading colon2, only show crate roots
None if !is_trivial_path => { None if is_absolute_path => {
ctx.process_all_names(&mut |name, res| match res { ctx.process_all_names(&mut |name, res| match res {
ScopeDef::ModuleDef(hir::ModuleDef::Module(m)) if m.is_crate_root(ctx.db) => { ScopeDef::ModuleDef(hir::ModuleDef::Module(m)) if m.is_crate_root(ctx.db) => {
acc.add_resolution(ctx, name, res); acc.add_resolution(ctx, name, res);

View file

@ -32,7 +32,7 @@ fn complete_undotted_self(acc: &mut Completions, ctx: &CompletionContext) {
if !ctx.config.enable_self_on_the_fly { if !ctx.config.enable_self_on_the_fly {
return; return;
} }
if !ctx.is_trivial_path() || ctx.is_path_disallowed() || !ctx.expects_expression() { if ctx.is_non_trivial_path() || ctx.is_path_disallowed() || !ctx.expects_expression() {
return; return;
} }
if let Some(func) = ctx.function_def.as_ref().and_then(|fn_| ctx.sema.to_def(fn_)) { if let Some(func) = ctx.function_def.as_ref().and_then(|fn_| ctx.sema.to_def(fn_)) {

View file

@ -5,7 +5,7 @@
use syntax::{SyntaxKind, T}; use syntax::{SyntaxKind, T};
use crate::{ use crate::{
context::{PathCompletionContext, PathKind}, context::{PathCompletionCtx, PathKind},
patterns::ImmediateLocation, patterns::ImmediateLocation,
CompletionContext, CompletionItem, CompletionItemKind, Completions, CompletionContext, CompletionItem, CompletionItemKind, Completions,
}; };
@ -122,9 +122,9 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
} }
let (can_be_stmt, in_loop_body) = match ctx.path_context { let (can_be_stmt, in_loop_body) = match ctx.path_context {
Some(PathCompletionContext { Some(PathCompletionCtx { is_absolute_path: false, can_be_stmt, in_loop_body, .. }) => {
is_trivial_path: true, can_be_stmt, in_loop_body, .. (can_be_stmt, in_loop_body)
}) => (can_be_stmt, in_loop_body), }
_ => return, _ => return,
}; };

View file

@ -6,7 +6,7 @@ use syntax::ast;
use crate::{ use crate::{
completions::module_or_fn_macro, completions::module_or_fn_macro,
context::{PathCompletionContext, PathKind}, context::{PathCompletionCtx, PathKind},
patterns::ImmediateLocation, patterns::ImmediateLocation,
CompletionContext, Completions, CompletionContext, Completions,
}; };
@ -15,18 +15,16 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
if ctx.is_path_disallowed() || ctx.has_impl_or_trait_prev_sibling() { if ctx.is_path_disallowed() || ctx.has_impl_or_trait_prev_sibling() {
return; return;
} }
let ((path, resolution), kind) = match ctx.path_context { let (qualifier, kind) = match ctx.path_context {
// let ... else, syntax would come in really handy here right now // let ... else, syntax would come in really handy here right now
Some(PathCompletionContext { qualifier: Some(ref qualifier), kind, .. }) => { Some(PathCompletionCtx { qualifier: Some(ref qualifier), kind, .. }) => (qualifier, kind),
(qualifier, kind)
}
_ => return, _ => return,
}; };
// special case `<_>::$0` as this doesn't resolve to anything. // special case `<_>::$0` as this doesn't resolve to anything.
if path.qualifier().is_none() { if qualifier.path.qualifier().is_none() {
if matches!( if matches!(
path.segment().and_then(|it| it.kind()), qualifier.path.segment().and_then(|it| it.kind()),
Some(ast::PathSegmentKind::Type { Some(ast::PathSegmentKind::Type {
type_ref: Some(ast::Type::InferType(_)), type_ref: Some(ast::Type::InferType(_)),
trait_ref: None, trait_ref: None,
@ -42,7 +40,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
} }
} }
let resolution = match resolution { let resolution = match &qualifier.resolution {
Some(res) => res, Some(res) => res,
None => return, None => return,
}; };

View file

@ -5,7 +5,7 @@ use ide_db::helpers::{insert_use::ImportScope, SnippetCap};
use syntax::T; use syntax::T;
use crate::{ use crate::{
context::PathCompletionContext, item::Builder, CompletionContext, CompletionItem, context::PathCompletionCtx, item::Builder, CompletionContext, CompletionItem,
CompletionItemKind, Completions, SnippetScope, CompletionItemKind, Completions, SnippetScope,
}; };
@ -21,7 +21,9 @@ pub(crate) fn complete_expr_snippet(acc: &mut Completions, ctx: &CompletionConte
} }
let can_be_stmt = match ctx.path_context { let can_be_stmt = match ctx.path_context {
Some(PathCompletionContext { is_trivial_path: true, can_be_stmt, .. }) => can_be_stmt, Some(PathCompletionCtx {
is_absolute_path: false, qualifier: None, can_be_stmt, ..
}) => can_be_stmt,
_ => return, _ => return,
}; };

View file

@ -5,7 +5,7 @@ use syntax::{ast, AstNode};
use crate::{ use crate::{
completions::module_or_fn_macro, completions::module_or_fn_macro,
context::{PathCompletionContext, PathKind}, context::{PathCompletionCtx, PathKind},
patterns::ImmediateLocation, patterns::ImmediateLocation,
CompletionContext, Completions, CompletionContext, Completions,
}; };
@ -16,11 +16,11 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
return; return;
} }
match ctx.path_context { match ctx.path_context {
Some(PathCompletionContext { Some(PathCompletionCtx {
kind: Some(PathKind::Vis { .. } | PathKind::Attr { .. } | PathKind::Use { .. }), kind: Some(PathKind::Vis { .. } | PathKind::Attr { .. } | PathKind::Use { .. }),
.. ..
}) => return, }) => return,
Some(PathCompletionContext { is_trivial_path: true, .. }) => (), Some(PathCompletionCtx { is_absolute_path: false, qualifier: None, .. }) => (),
_ => return, _ => return,
} }

View file

@ -1,36 +1,31 @@
//! Completion for use trees //! Completion for use trees
use std::iter;
use hir::ScopeDef; use hir::ScopeDef;
use syntax::{ast, AstNode}; use syntax::{ast, AstNode};
use crate::{ use crate::{
context::{CompletionContext, PathCompletionContext, PathKind}, context::{CompletionContext, PathCompletionCtx, PathKind, PathQualifierCtx},
Completions, Completions,
}; };
pub(crate) fn complete_use_tree(acc: &mut Completions, ctx: &CompletionContext) { pub(crate) fn complete_use_tree(acc: &mut Completions, ctx: &CompletionContext) {
let (is_trivial_path, qualifier, use_tree_parent) = match ctx.path_context { let (is_absolute_path, qualifier) = match ctx.path_context {
Some(PathCompletionContext { Some(PathCompletionCtx {
kind: Some(PathKind::Use), kind: Some(PathKind::Use),
is_trivial_path, is_absolute_path,
use_tree_parent,
ref qualifier, ref qualifier,
.. ..
}) => (is_trivial_path, qualifier, use_tree_parent), }) => (is_absolute_path, qualifier),
_ => return, _ => return,
}; };
match qualifier { match qualifier {
Some((path, qualifier)) => { Some(PathQualifierCtx { path, resolution, is_super_chain, use_tree_parent }) => {
let is_super_chain = iter::successors(Some(path.clone()), |p| p.qualifier()) if *is_super_chain {
.all(|p| p.segment().and_then(|s| s.super_token()).is_some());
if is_super_chain {
acc.add_keyword(ctx, "super::"); acc.add_keyword(ctx, "super::");
} }
// only show `self` in a new use-tree when the qualifier doesn't end in self // only show `self` in a new use-tree when the qualifier doesn't end in self
let not_preceded_by_self = use_tree_parent let not_preceded_by_self = *use_tree_parent
&& !matches!( && !matches!(
path.segment().and_then(|it| it.kind()), path.segment().and_then(|it| it.kind()),
Some(ast::PathSegmentKind::SelfKw) Some(ast::PathSegmentKind::SelfKw)
@ -39,12 +34,12 @@ pub(crate) fn complete_use_tree(acc: &mut Completions, ctx: &CompletionContext)
acc.add_keyword(ctx, "self"); acc.add_keyword(ctx, "self");
} }
let qualifier = match qualifier { let resolution = match resolution {
Some(it) => it, Some(it) => it,
None => return, None => return,
}; };
match qualifier { match resolution {
hir::PathResolution::Def(hir::ModuleDef::Module(module)) => { hir::PathResolution::Def(hir::ModuleDef::Module(module)) => {
let module_scope = module.scope(ctx.db, ctx.module); let module_scope = module.scope(ctx.db, ctx.module);
let unknown_is_current = |name: &hir::Name| { let unknown_is_current = |name: &hir::Name| {
@ -82,7 +77,7 @@ pub(crate) fn complete_use_tree(acc: &mut Completions, ctx: &CompletionContext)
} }
} }
// fresh use tree with leading colon2, only show crate roots // fresh use tree with leading colon2, only show crate roots
None if !is_trivial_path => { None if is_absolute_path => {
cov_mark::hit!(use_tree_crate_roots_only); cov_mark::hit!(use_tree_crate_roots_only);
ctx.process_all_names(&mut |name, res| match res { ctx.process_all_names(&mut |name, res| match res {
ScopeDef::ModuleDef(hir::ModuleDef::Module(m)) if m.is_crate_root(ctx.db) => { ScopeDef::ModuleDef(hir::ModuleDef::Module(m)) if m.is_crate_root(ctx.db) => {

View file

@ -1,28 +1,26 @@
//! Completion for visibility specifiers. //! Completion for visibility specifiers.
use std::iter;
use hir::ScopeDef; use hir::ScopeDef;
use crate::{ use crate::{
context::{CompletionContext, PathCompletionContext, PathKind}, context::{CompletionContext, PathCompletionCtx, PathKind, PathQualifierCtx},
Completions, Completions,
}; };
pub(crate) fn complete_vis(acc: &mut Completions, ctx: &CompletionContext) { pub(crate) fn complete_vis(acc: &mut Completions, ctx: &CompletionContext) {
let (is_trivial_path, qualifier, has_in_token) = match ctx.path_context { let (is_absolute_path, qualifier, has_in_token) = match ctx.path_context {
Some(PathCompletionContext { Some(PathCompletionCtx {
kind: Some(PathKind::Vis { has_in_token }), kind: Some(PathKind::Vis { has_in_token }),
is_trivial_path, is_absolute_path,
ref qualifier, ref qualifier,
.. ..
}) => (is_trivial_path, qualifier, has_in_token), }) => (is_absolute_path, qualifier, has_in_token),
_ => return, _ => return,
}; };
match qualifier { match qualifier {
Some((path, qualifier)) => { Some(PathQualifierCtx { resolution, is_super_chain, .. }) => {
if let Some(hir::PathResolution::Def(hir::ModuleDef::Module(module))) = qualifier { if let Some(hir::PathResolution::Def(hir::ModuleDef::Module(module))) = resolution {
if let Some(current_module) = ctx.module { if let Some(current_module) = ctx.module {
let next_towards_current = current_module let next_towards_current = current_module
.path_to_root(ctx.db) .path_to_root(ctx.db)
@ -38,13 +36,11 @@ pub(crate) fn complete_vis(acc: &mut Completions, ctx: &CompletionContext) {
} }
} }
let is_super_chain = iter::successors(Some(path.clone()), |p| p.qualifier()) if *is_super_chain {
.all(|p| p.segment().and_then(|s| s.super_token()).is_some());
if is_super_chain {
acc.add_keyword(ctx, "super::"); acc.add_keyword(ctx, "super::");
} }
} }
None if is_trivial_path => { None if !is_absolute_path => {
if !has_in_token { if !has_in_token {
cov_mark::hit!(kw_completion_in); cov_mark::hit!(kw_completion_in);
acc.add_keyword(ctx, "in"); acc.add_keyword(ctx, "in");

View file

@ -36,6 +36,7 @@ pub(crate) enum PatternRefutability {
Refutable, Refutable,
Irrefutable, Irrefutable,
} }
pub(crate) enum Visible { pub(crate) enum Visible {
Yes, Yes,
Editable, Editable,
@ -54,18 +55,13 @@ pub(super) enum PathKind {
} }
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct PathCompletionContext { pub(crate) struct PathCompletionCtx {
/// If this is a call with () already there /// If this is a call with () already there
has_call_parens: bool, has_call_parens: bool,
/// A single-indent path, like `foo`. `::foo` should not be considered a trivial path. /// Whether this path stars with a `::`.
pub(super) is_trivial_path: bool, pub(super) is_absolute_path: bool,
/// If not a trivial path, the prefix (qualifier). /// The qualifier of the current path if it exists.
pub(super) qualifier: Option<(ast::Path, Option<PathResolution>)>, pub(super) qualifier: Option<PathQualifierCtx>,
#[allow(dead_code)]
/// If not a trivial path, the suffix (parent).
pub(super) parent: Option<ast::Path>,
/// Whether the qualifier comes from a use tree parent or not
pub(super) use_tree_parent: bool,
pub(super) kind: Option<PathKind>, pub(super) kind: Option<PathKind>,
/// Whether the path segment has type args or not. /// Whether the path segment has type args or not.
pub(super) has_type_args: bool, pub(super) has_type_args: bool,
@ -74,6 +70,16 @@ pub(crate) struct PathCompletionContext {
pub(super) in_loop_body: bool, pub(super) in_loop_body: bool,
} }
#[derive(Debug)]
pub(crate) struct PathQualifierCtx {
pub path: ast::Path,
pub resolution: Option<PathResolution>,
/// Whether this path consists solely of `super` segments
pub is_super_chain: bool,
/// Whether the qualifier comes from a use tree parent or not
pub use_tree_parent: bool,
}
#[derive(Debug)] #[derive(Debug)]
pub(super) struct PatternContext { pub(super) struct PatternContext {
pub(super) refutability: PatternRefutability, pub(super) refutability: PatternRefutability,
@ -131,7 +137,7 @@ pub(crate) struct CompletionContext<'a> {
pub(super) lifetime_ctx: Option<LifetimeContext>, pub(super) lifetime_ctx: Option<LifetimeContext>,
pub(super) pattern_ctx: Option<PatternContext>, pub(super) pattern_ctx: Option<PatternContext>,
pub(super) path_context: Option<PathCompletionContext>, pub(super) path_context: Option<PathCompletionCtx>,
pub(super) locals: Vec<(Name, Local)>, pub(super) locals: Vec<(Name, Local)>,
@ -264,27 +270,29 @@ impl<'a> CompletionContext<'a> {
} }
pub(crate) fn expects_expression(&self) -> bool { pub(crate) fn expects_expression(&self) -> bool {
matches!(self.path_context, Some(PathCompletionContext { kind: Some(PathKind::Expr), .. })) matches!(self.path_context, Some(PathCompletionCtx { kind: Some(PathKind::Expr), .. }))
} }
pub(crate) fn expects_type(&self) -> bool { pub(crate) fn expects_type(&self) -> bool {
matches!(self.path_context, Some(PathCompletionContext { kind: Some(PathKind::Type), .. })) matches!(self.path_context, Some(PathCompletionCtx { kind: Some(PathKind::Type), .. }))
} }
pub(crate) fn path_is_call(&self) -> bool { pub(crate) fn path_is_call(&self) -> bool {
self.path_context.as_ref().map_or(false, |it| it.has_call_parens) self.path_context.as_ref().map_or(false, |it| it.has_call_parens)
} }
pub(crate) fn is_trivial_path(&self) -> bool {
matches!(self.path_context, Some(PathCompletionContext { is_trivial_path: true, .. }))
}
pub(crate) fn is_non_trivial_path(&self) -> bool { pub(crate) fn is_non_trivial_path(&self) -> bool {
matches!(self.path_context, Some(PathCompletionContext { is_trivial_path: false, .. })) matches!(
self.path_context,
Some(
PathCompletionCtx { is_absolute_path: true, .. }
| PathCompletionCtx { qualifier: Some(_), .. }
)
)
} }
pub(crate) fn path_qual(&self) -> Option<&ast::Path> { pub(crate) fn path_qual(&self) -> Option<&ast::Path> {
self.path_context.as_ref().and_then(|it| it.qualifier.as_ref().map(|(it, _)| it)) self.path_context.as_ref().and_then(|it| it.qualifier.as_ref().map(|it| &it.path))
} }
pub(crate) fn path_kind(&self) -> Option<PathKind> { pub(crate) fn path_kind(&self) -> Option<PathKind> {
@ -791,20 +799,18 @@ impl<'a> CompletionContext<'a> {
sema: &Semantics<RootDatabase>, sema: &Semantics<RootDatabase>,
original_file: &SyntaxNode, original_file: &SyntaxNode,
name_ref: ast::NameRef, name_ref: ast::NameRef,
) -> Option<(PathCompletionContext, Option<PatternContext>)> { ) -> Option<(PathCompletionCtx, Option<PatternContext>)> {
let parent = name_ref.syntax().parent()?; let parent = name_ref.syntax().parent()?;
let segment = ast::PathSegment::cast(parent)?; let segment = ast::PathSegment::cast(parent)?;
let path = segment.parent_path(); let path = segment.parent_path();
let mut path_ctx = PathCompletionContext { let mut path_ctx = PathCompletionCtx {
has_call_parens: false, has_call_parens: false,
is_trivial_path: false, is_absolute_path: false,
qualifier: None, qualifier: None,
parent: None,
has_type_args: false, has_type_args: false,
can_be_stmt: false, can_be_stmt: false,
in_loop_body: false, in_loop_body: false,
use_tree_parent: false,
kind: None, kind: None,
}; };
let mut pat_ctx = None; let mut pat_ctx = None;
@ -859,26 +865,31 @@ impl<'a> CompletionContext<'a> {
path_ctx.has_type_args = segment.generic_arg_list().is_some(); path_ctx.has_type_args = segment.generic_arg_list().is_some();
if let Some((path, use_tree_parent)) = path_or_use_tree_qualifier(&path) { if let Some((path, use_tree_parent)) = path_or_use_tree_qualifier(&path) {
path_ctx.use_tree_parent = use_tree_parent; if !use_tree_parent {
path_ctx.is_absolute_path =
path.top_path().segment().map_or(false, |it| it.coloncolon_token().is_some());
}
let path = path let path = path
.segment() .segment()
.and_then(|it| find_node_in_file(original_file, &it)) .and_then(|it| find_node_in_file(original_file, &it))
.map(|it| it.parent_path()); .map(|it| it.parent_path());
path_ctx.qualifier = path.map(|path| { path_ctx.qualifier = path.map(|path| {
let res = sema.resolve_path(&path); let res = sema.resolve_path(&path);
(path, res) let is_super_chain = iter::successors(Some(path.clone()), |p| p.qualifier())
.all(|p| p.segment().and_then(|s| s.super_token()).is_some());
PathQualifierCtx { path, resolution: res, is_super_chain, use_tree_parent }
}); });
return Some((path_ctx, pat_ctx)); return Some((path_ctx, pat_ctx));
} }
if let Some(segment) = path.segment() { if let Some(segment) = path.segment() {
if segment.coloncolon_token().is_some() { if segment.coloncolon_token().is_some() {
path_ctx.is_absolute_path = true;
return Some((path_ctx, pat_ctx)); return Some((path_ctx, pat_ctx));
} }
} }
path_ctx.is_trivial_path = true;
// Find either enclosing expr statement (thing with `;`) or a // Find either enclosing expr statement (thing with `;`) or a
// block. If block, check that we are the last expr. // block. If block, check that we are the last expr.
path_ctx.can_be_stmt = name_ref path_ctx.can_be_stmt = name_ref
@ -969,7 +980,7 @@ fn path_or_use_tree_qualifier(path: &ast::Path) -> Option<(ast::Path, bool)> {
} }
let use_tree_list = path.syntax().ancestors().find_map(ast::UseTreeList::cast)?; let use_tree_list = path.syntax().ancestors().find_map(ast::UseTreeList::cast)?;
let use_tree = use_tree_list.syntax().parent().and_then(ast::UseTree::cast)?; let use_tree = use_tree_list.syntax().parent().and_then(ast::UseTree::cast)?;
use_tree.path().zip(Some(true)) Some((use_tree.path()?, true))
} }
fn has_ref(token: &SyntaxToken) -> bool { fn has_ref(token: &SyntaxToken) -> bool {

View file

@ -19,7 +19,7 @@ use ide_db::{
use syntax::{SmolStr, SyntaxKind, TextRange}; use syntax::{SmolStr, SyntaxKind, TextRange};
use crate::{ use crate::{
context::{PathCompletionContext, PathKind}, context::{PathCompletionCtx, PathKind},
item::{CompletionRelevanceTypeMatch, ImportEdit}, item::{CompletionRelevanceTypeMatch, ImportEdit},
render::{enum_variant::render_variant, function::render_fn, macro_::render_macro}, render::{enum_variant::render_variant, function::render_fn, macro_::render_macro},
CompletionContext, CompletionItem, CompletionItemKind, CompletionRelevance, CompletionContext, CompletionItem, CompletionItemKind, CompletionRelevance,
@ -234,7 +234,7 @@ fn render_resolution_(
// Add `<>` for generic types // Add `<>` for generic types
let type_path_no_ty_args = matches!( let type_path_no_ty_args = matches!(
ctx.completion.path_context, ctx.completion.path_context,
Some(PathCompletionContext { kind: Some(PathKind::Type), has_type_args: false, .. }) Some(PathCompletionCtx { kind: Some(PathKind::Type), has_type_args: false, .. })
) && ctx.completion.config.add_call_parenthesis; ) && ctx.completion.config.add_call_parenthesis;
if type_path_no_ty_args { if type_path_no_ty_args {
if let Some(cap) = ctx.snippet_cap() { if let Some(cap) = ctx.snippet_cap() {