From 018bf3d7b1cdc070aa1a0926df0840f1cf9a03b9 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Wed, 3 Jul 2019 17:37:56 +0300 Subject: Added resolve submodules with raw name #1211 --- crates/ra_hir/src/nameres/collector.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/ra_hir/src') 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( let mod_name = path.file_stem().unwrap_or("unknown"); let is_dir_owner = is_root || mod_name == "mod"; + let name = resolve_mod_name(name.to_string()); let file_mod = dir_path.join(format!("{}.rs", name)); let dir_mod = dir_path.join(format!("{}/mod.rs", name)); let file_dir_mod = dir_path.join(format!("{}/{}.rs", mod_name, name)); @@ -662,6 +663,14 @@ fn resolve_submodule( } } +fn resolve_mod_name(name: String) -> String { + if name.starts_with("r#") { + name.replace("r#", "") + } else { + name + } +} + #[cfg(test)] mod tests { use ra_db::SourceDatabase; -- cgit v1.2.3