mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 02:13:11 +00:00
feat(els): add deep completion
This commit is contained in:
parent
257b38cec7
commit
0744c35517
7 changed files with 280 additions and 69 deletions
|
@ -1034,6 +1034,10 @@ impl Context {
|
|||
attrs
|
||||
}
|
||||
|
||||
pub fn local_dir(&self) -> Dict<&VarName, &VarInfo> {
|
||||
self.type_dir(self)
|
||||
}
|
||||
|
||||
pub(crate) fn mod_cache(&self) -> &SharedModuleCache {
|
||||
&self.shared().mod_cache
|
||||
}
|
||||
|
|
|
@ -145,6 +145,10 @@ impl ModuleCache {
|
|||
self.cache.insert(new, entry);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &ModuleEntry)> {
|
||||
self.cache.iter()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
@ -161,6 +165,14 @@ impl SharedModuleCache {
|
|||
Self(Shared::new(ModuleCache::new()))
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.borrow().cache.is_empty()
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.0.borrow().cache.len()
|
||||
}
|
||||
|
||||
pub fn get<Q: Eq + Hash + ?Sized>(&self, path: &Q) -> Option<&ModuleEntry>
|
||||
where
|
||||
PathBuf: Borrow<Q>,
|
||||
|
@ -230,4 +242,9 @@ impl SharedModuleCache {
|
|||
pub fn rename_path(&self, path: &PathBuf, new: PathBuf) {
|
||||
self.0.borrow_mut().rename_path(path, new);
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &ModuleEntry)> {
|
||||
let ref_ = unsafe { self.0.as_ptr().as_ref().unwrap() };
|
||||
ref_.iter()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue