diff options
Diffstat (limited to 'crates/libanalysis/src/lib.rs')
-rw-r--r-- | crates/libanalysis/src/lib.rs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs index 19b64fece..a50a0f32f 100644 --- a/crates/libanalysis/src/lib.rs +++ b/crates/libanalysis/src/lib.rs | |||
@@ -163,15 +163,21 @@ impl World { | |||
163 | Some(name) => name.text(), | 163 | Some(name) => name.text(), |
164 | None => return Vec::new(), | 164 | None => return Vec::new(), |
165 | }; | 165 | }; |
166 | let id = match self.resolve_relative_path(id, &PathBuf::from(format!("../{}.rs", name))) { | 166 | let paths = &[ |
167 | Some(id) => id, | 167 | PathBuf::from(format!("../{}.rs", name)), |
168 | None => return Vec::new(), | 168 | PathBuf::from(format!("../{}/mod.rs", name)), |
169 | }; | 169 | ]; |
170 | vec![(id, FileSymbol { | 170 | paths.iter() |
171 | name: name.clone(), | 171 | .filter_map(|path| self.resolve_relative_path(id, path)) |
172 | node_range: TextRange::offset_len(0.into(), 0.into()), | 172 | .map(|id| { |
173 | kind: MODULE, | 173 | let symbol = FileSymbol { |
174 | })] | 174 | name: name.clone(), |
175 | node_range: TextRange::offset_len(0.into(), 0.into()), | ||
176 | kind: MODULE, | ||
177 | }; | ||
178 | (id, symbol) | ||
179 | }) | ||
180 | .collect() | ||
175 | } | 181 | } |
176 | 182 | ||
177 | fn resolve_relative_path(&self, id: FileId, path: &Path) -> Option<FileId> { | 183 | fn resolve_relative_path(&self, id: FileId, path: &Path) -> Option<FileId> { |