mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Order modules in docs sidebar based on exposes
This commit is contained in:
parent
9a12175a96
commit
89be091f87
3 changed files with 19 additions and 7 deletions
|
@ -3291,7 +3291,7 @@ fn finish(
|
|||
exposed_types_storage: ExposedTypesStorageSubs,
|
||||
resolved_implementations: ResolvedImplementations,
|
||||
dep_idents: IdentIdsByModule,
|
||||
documentation: VecMap<ModuleId, ModuleDocumentation>,
|
||||
mut documentation: VecMap<ModuleId, ModuleDocumentation>,
|
||||
abilities_store: AbilitiesStore,
|
||||
//
|
||||
#[cfg(debug_assertions)] checkmate: Option<roc_checkmate::Collector>,
|
||||
|
@ -3330,6 +3330,18 @@ fn finish(
|
|||
|
||||
roc_checkmate::dump_checkmate!(checkmate);
|
||||
|
||||
let mut docs_by_module = Vec::with_capacity(state.exposed_modules.len());
|
||||
|
||||
for module_id in state.exposed_modules.iter() {
|
||||
let docs = documentation.remove(module_id).unwrap_or_else(|| {
|
||||
panic!("A module was exposed but didn't have an entry in `documentation` somehow: {module_id:?}");
|
||||
});
|
||||
|
||||
docs_by_module.push(docs);
|
||||
}
|
||||
|
||||
debug_assert_eq!(documentation.len(), 0);
|
||||
|
||||
LoadedModule {
|
||||
module_id: state.root_id,
|
||||
interns,
|
||||
|
@ -3346,7 +3358,7 @@ fn finish(
|
|||
resolved_implementations,
|
||||
sources,
|
||||
timings: state.timings,
|
||||
docs_by_module: documentation,
|
||||
docs_by_module,
|
||||
abilities_store,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ pub struct LoadedModule {
|
|||
pub resolved_implementations: ResolvedImplementations,
|
||||
pub sources: MutMap<ModuleId, (PathBuf, Box<str>)>,
|
||||
pub timings: MutMap<ModuleId, ModuleTiming>,
|
||||
pub docs_by_module: VecMap<ModuleId, ModuleDocumentation>,
|
||||
pub docs_by_module: Vec<(ModuleId, ModuleDocumentation)>,
|
||||
pub abilities_store: AbilitiesStore,
|
||||
pub typechecked: MutMap<ModuleId, CheckedModule>,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue