diff options
author | Alexander Andreev <[email protected]> | 2019-07-03 15:37:56 +0100 |
---|---|---|
committer | Alexander Andreev <[email protected]> | 2019-07-03 15:37:56 +0100 |
commit | 018bf3d7b1cdc070aa1a0926df0840f1cf9a03b9 (patch) | |
tree | 2fc8a842b9aba1d939bd7be618506d74e24044d7 | |
parent | f15f0d1ec006c6c628fb70414d311bd85c2a0469 (diff) |
Added resolve submodules with raw name
#1211
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index ef4d1ed70..e11198e02 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs | |||
@@ -643,6 +643,7 @@ fn resolve_submodule( | |||
643 | let mod_name = path.file_stem().unwrap_or("unknown"); | 643 | let mod_name = path.file_stem().unwrap_or("unknown"); |
644 | let is_dir_owner = is_root || mod_name == "mod"; | 644 | let is_dir_owner = is_root || mod_name == "mod"; |
645 | 645 | ||
646 | let name = resolve_mod_name(name.to_string()); | ||
646 | let file_mod = dir_path.join(format!("{}.rs", name)); | 647 | let file_mod = dir_path.join(format!("{}.rs", name)); |
647 | let dir_mod = dir_path.join(format!("{}/mod.rs", name)); | 648 | let dir_mod = dir_path.join(format!("{}/mod.rs", name)); |
648 | let file_dir_mod = dir_path.join(format!("{}/{}.rs", mod_name, name)); | 649 | let file_dir_mod = dir_path.join(format!("{}/{}.rs", mod_name, name)); |
@@ -662,6 +663,14 @@ fn resolve_submodule( | |||
662 | } | 663 | } |
663 | } | 664 | } |
664 | 665 | ||
666 | fn resolve_mod_name(name: String) -> String { | ||
667 | if name.starts_with("r#") { | ||
668 | name.replace("r#", "") | ||
669 | } else { | ||
670 | name | ||
671 | } | ||
672 | } | ||
673 | |||
665 | #[cfg(test)] | 674 | #[cfg(test)] |
666 | mod tests { | 675 | mod tests { |
667 | use ra_db::SourceDatabase; | 676 | use ra_db::SourceDatabase; |