mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:16 +00:00
[ty] Fix a bug with "all_submodule_names_for_package" API
The names of the submodules returned should be *complete*. This is the contract of `Module::name`. However, we were previously only returning the basename of the submodule.
This commit is contained in:
parent
cf16fc4aa4
commit
6ec52991cb
3 changed files with 21 additions and 14 deletions
|
@ -181,8 +181,11 @@ impl<'db> SemanticModel<'db> {
|
|||
let mut completions = vec![];
|
||||
for submodule in module.all_submodules(self.db) {
|
||||
let ty = Type::module_literal(self.db, self.file, *submodule);
|
||||
let Some(base) = submodule.name(self.db).components().next_back() else {
|
||||
continue;
|
||||
};
|
||||
completions.push(Completion {
|
||||
name: Name::new(submodule.name(self.db).as_str()),
|
||||
name: Name::new(base),
|
||||
ty: Some(ty),
|
||||
kind: None,
|
||||
builtin,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue