mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
support docs in app, platform and packages
This commit is contained in:
parent
d95da9dd5b
commit
f6799cae92
2 changed files with 41 additions and 4 deletions
|
@ -5400,11 +5400,48 @@ fn canonicalize_and_constrain<'a>(
|
||||||
// Generate documentation information
|
// Generate documentation information
|
||||||
// TODO: store timing information?
|
// TODO: store timing information?
|
||||||
let module_docs = match header_type {
|
let module_docs = match header_type {
|
||||||
HeaderType::App { .. } => None,
|
HeaderType::App {
|
||||||
HeaderType::Platform { .. } | HeaderType::Package { .. } => {
|
output_name: StrLiteral::PlainLine(str),
|
||||||
// TODO: actually generate docs for platform and package modules.
|
..
|
||||||
|
} => {
|
||||||
|
let mut scope = module_output.scope.clone();
|
||||||
|
scope.add_docs_imports();
|
||||||
|
let docs = crate::docs::generate_module_docs(
|
||||||
|
scope,
|
||||||
|
module_id,
|
||||||
|
module_ids,
|
||||||
|
str.into(),
|
||||||
|
&parsed_defs_for_docs,
|
||||||
|
exposed_module_ids,
|
||||||
|
module_output.exposed_symbols.clone(),
|
||||||
|
parsed.header_comments,
|
||||||
|
);
|
||||||
|
Some(docs)
|
||||||
|
}
|
||||||
|
HeaderType::App { .. } => {
|
||||||
|
//TODO:Eli This may not be needed after module params becuase app headers might have non string names
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
HeaderType::Platform {
|
||||||
|
config_shorthand, ..
|
||||||
|
}
|
||||||
|
| HeaderType::Package {
|
||||||
|
config_shorthand, ..
|
||||||
|
} => {
|
||||||
|
let mut scope = module_output.scope.clone();
|
||||||
|
scope.add_docs_imports();
|
||||||
|
let docs = crate::docs::generate_module_docs(
|
||||||
|
scope,
|
||||||
|
module_id,
|
||||||
|
module_ids,
|
||||||
|
config_shorthand.into(),
|
||||||
|
&parsed_defs_for_docs,
|
||||||
|
exposed_module_ids,
|
||||||
|
module_output.exposed_symbols.clone(),
|
||||||
|
parsed.header_comments,
|
||||||
|
);
|
||||||
|
Some(docs)
|
||||||
|
}
|
||||||
HeaderType::Interface { name, .. }
|
HeaderType::Interface { name, .. }
|
||||||
| HeaderType::Builtin { name, .. }
|
| HeaderType::Builtin { name, .. }
|
||||||
| HeaderType::Hosted { name, .. } => {
|
| HeaderType::Hosted { name, .. } => {
|
||||||
|
|
|
@ -457,7 +457,7 @@ fn make_completion_items_string(
|
||||||
.map(|(symbol, var)| make_completion_item(subs, module_id, interns, None, symbol, var))
|
.map(|(symbol, var)| make_completion_item(subs, module_id, interns, None, symbol, var))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
///This efficently walks the list of docs checking fewer times
|
///Efficently walks the list of docs collecting the docs for completions as we go. Should be faster than re-walking for every completion
|
||||||
fn get_completion_docs(
|
fn get_completion_docs(
|
||||||
completions: &[(Symbol, Variable)],
|
completions: &[(Symbol, Variable)],
|
||||||
docs: &ModuleDocumentation,
|
docs: &ModuleDocumentation,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue