dev: cache expression information correctly (#736)

* dev: cache expression information correctly

* rev
This commit is contained in:
Myriad-Dreamin 2024-10-27 20:20:59 +08:00 committed by GitHub
parent 2c38695b6f
commit 1d49e110e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 430 additions and 187 deletions

View file

@ -114,13 +114,12 @@ impl StatefulRequest for CompletionRequest {
let parent = cano_expr.parent()?;
if matches!(parent.kind(), SyntaxKind::Named | SyntaxKind::Args) {
let ty_chk = ctx.type_check(&source);
if let Some(ty_chk) = ty_chk {
let ty = ty_chk.type_of_span(cano_expr.span());
log::debug!("check string ty: {ty:?}");
if let Some(Ty::Builtin(BuiltinTy::Path(path_filter))) = ty {
completion_result =
complete_path(ctx, Some(cano_expr), &source, cursor, &path_filter);
}
let ty = ty_chk.type_of_span(cano_expr.span());
log::debug!("check string ty: {ty:?}");
if let Some(Ty::Builtin(BuiltinTy::Path(path_filter))) = ty {
completion_result =
complete_path(ctx, Some(cano_expr), &source, cursor, &path_filter);
}
}
}