fix: typos in tinymist-query (#956)

This commit is contained in:
Myriad-Dreamin 2024-12-07 11:25:34 +08:00 committed by GitHub
parent 0d40da4ada
commit 9efc3d55d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View file

@ -191,7 +191,7 @@ fn complete_markup(ctx: &mut CompletionContext) -> bool {
}
// Anywhere: "|".
if !is_triggerred_by_punc(ctx.trigger_character) && ctx.explicit {
if !is_triggered_by_punc(ctx.trigger_character) && ctx.explicit {
ctx.from = ctx.cursor;
markup_completions(ctx);
return true;
@ -320,7 +320,7 @@ fn complete_math(ctx: &mut CompletionContext) -> bool {
}
// Behind existing atom or identifier: "$a|$" or "$abc|$".
if !is_triggerred_by_punc(ctx.trigger_character)
if !is_triggered_by_punc(ctx.trigger_character)
&& matches!(ctx.leaf.kind(), SyntaxKind::Text | SyntaxKind::MathIdent)
{
ctx.from = ctx.leaf.offset();
@ -329,7 +329,7 @@ fn complete_math(ctx: &mut CompletionContext) -> bool {
}
// Anywhere: "$|$".
if !is_triggerred_by_punc(ctx.trigger_character) && ctx.explicit {
if !is_triggered_by_punc(ctx.trigger_character) && ctx.explicit {
ctx.from = ctx.cursor;
math_completions(ctx);
return true;
@ -547,7 +547,7 @@ fn complete_imports(ctx: &mut CompletionContext) -> bool {
}
// Behind a half-started identifier in an import list:
// "#import "path.typ": thi|",
// "#import "path.typ": th|",
if_chain! {
if matches!(ctx.leaf.kind(), SyntaxKind::Ident | SyntaxKind::Dot);
if let Some(path_ctx) = ctx.leaf.clone().parent();
@ -1168,6 +1168,6 @@ fn slice_at(s: &str, mut rng: Range<usize>) -> &str {
&s[rng]
}
fn is_triggerred_by_punc(trigger_character: Option<char>) -> bool {
fn is_triggered_by_punc(trigger_character: Option<char>) -> bool {
trigger_character.is_some_and(|c| c.is_ascii_punctuation())
}

View file

@ -607,7 +607,7 @@ fn check_surrounding_syntax(mut leaf: &LinkedNode) -> Option<SurroundingSyntax>
}
SyntaxKind::SetRule => {
let rule = parent.get().cast::<ast::SetRule>()?;
if met_args || encolsed_by(parent, rule.condition().map(|s| s.span()), leaf) {
if met_args || enclosed_by(parent, rule.condition().map(|s| s.span()), leaf) {
return Some(Regular);
} else {
return Some(SetRule);
@ -963,7 +963,7 @@ impl FnCompletionFeat {
}
}
fn encolsed_by(parent: &LinkedNode, s: Option<Span>, leaf: &LinkedNode) -> bool {
fn enclosed_by(parent: &LinkedNode, s: Option<Span>, leaf: &LinkedNode) -> bool {
s.and_then(|s| parent.find(s)?.find(leaf.span())).is_some()
}
@ -1417,13 +1417,13 @@ pub(crate) fn complete_type(ctx: &mut CompletionContext) -> Option<()> {
}
let mut completions = std::mem::take(&mut ctx.completions);
let explict = ctx.explicit;
let explicit = ctx.explicit;
ctx.explicit = true;
let ty = Some(Ty::from_types(ctx.seen_types.iter().cloned()));
let from_ty = std::mem::replace(&mut ctx.from_ty, ty);
complete_code(ctx, true);
ctx.from_ty = from_ty;
ctx.explicit = explict;
ctx.explicit = explicit;
match scope {
SurroundingSyntax::Regular => {}