mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-15 08:01:01 +00:00
feat: Adding extract_module assist
This commit is contained in:
parent
6c7526d308
commit
32b95ea310
5 changed files with 1447 additions and 1 deletions
|
@ -196,6 +196,12 @@ pub fn path_from_segments(
|
|||
format!("use {};", segments)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn join_paths(paths: impl IntoIterator<Item = ast::Path>) -> ast::Path {
|
||||
let paths = paths.into_iter().map(|it| it.syntax().clone()).join("::");
|
||||
ast_from_text(&format!("use {};", paths))
|
||||
}
|
||||
|
||||
// FIXME: should not be pub
|
||||
pub fn path_from_text(text: &str) -> ast::Path {
|
||||
ast_from_text(&format!("fn main() {{ let test = {}; }}", text))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue