-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add children modules feature #19255
base: master
Are you sure you want to change the base?
Add children modules feature #19255
Conversation
@Veykril I have implemented whatever was stated in issue. Looks like I also need need to add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this plural, that is all children_module
occurences should be children_modules
crates/ide/src/children_module.rs
Outdated
// Return all the children module inside the ItemList of the parent module | ||
module | ||
.syntax() | ||
.children() | ||
.filter_map(ast::ItemList::cast) | ||
.flat_map(|it| it.syntax().children()) | ||
.filter_map(ast::Module::cast) | ||
.flat_map(|m| { | ||
sema.to_def(&m) | ||
.into_iter() | ||
.flat_map(|module| NavigationTarget::from_module_to_decl(db, module)) | ||
}) | ||
.collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Return all the children module inside the ItemList of the parent module | |
module | |
.syntax() | |
.children() | |
.filter_map(ast::ItemList::cast) | |
.flat_map(|it| it.syntax().children()) | |
.filter_map(ast::Module::cast) | |
.flat_map(|m| { | |
sema.to_def(&m) | |
.into_iter() | |
.flat_map(|module| NavigationTarget::from_module_to_decl(db, module)) | |
}) | |
.collect() | |
sema | |
.to_def(&module) | |
.into_iter() | |
.flat_map(|module| module.children(db)) | |
.map(|module| NavigationTarget::from_module_to_decl(db, module)) | |
.collect(), |
crates/ide/src/children_module.rs
Outdated
// Return all the children module inside the source file | ||
source_file | ||
.syntax() | ||
.children() | ||
.filter_map(ast::Module::cast) | ||
.flat_map(|m| { | ||
sema.to_def(&m) | ||
.into_iter() | ||
.flat_map(|module| NavigationTarget::from_module_to_decl(db, module)) | ||
}) | ||
.collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Return all the children module inside the source file | |
source_file | |
.syntax() | |
.children() | |
.filter_map(ast::Module::cast) | |
.flat_map(|m| { | |
sema.to_def(&m) | |
.into_iter() | |
.flat_map(|module| NavigationTarget::from_module_to_decl(db, module)) | |
}) | |
.collect() | |
sema | |
.file_to_module_defs(position.file_id) | |
.flat_map(|module| module.children(db)) | |
.map(|module| NavigationTarget::from_module_to_decl(db, module)) | |
.collect(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Will need a rebase + updating the hash in docs/dev/lsp-extensions.md. |
This might be autocorrect, but I think this should be called |
Links to #17401