Fix completion in when typing integer.|

It should show integer, not floating point methods.
This commit is contained in:
Chayim Refael Friedman 2025-06-27 00:12:27 +03:00
parent 11c7207aa5
commit 0b6df1716d
3 changed files with 50 additions and 1 deletions

View file

@ -3043,10 +3043,17 @@ pub struct BuiltinType {
}
impl BuiltinType {
// Constructors are added on demand, feel free to add more.
pub fn str() -> BuiltinType {
BuiltinType { inner: hir_def::builtin_type::BuiltinType::Str }
}
pub fn i32() -> BuiltinType {
BuiltinType {
inner: hir_def::builtin_type::BuiltinType::Int(hir_ty::primitive::BuiltinInt::I32),
}
}
pub fn ty<'db>(self, db: &'db dyn HirDatabase) -> Type<'db> {
let core = Crate::core(db).map(|core| core.id).unwrap_or_else(|| db.all_crates()[0]);
Type::new_for_crate(core, TyBuilder::builtin(self.inner))