This commit is contained in:
Eli Dowling 2024-02-11 18:26:24 +10:00 committed by faldor20
parent 6c36d5f510
commit 584a21ea7c
No known key found for this signature in database
GPG key ID: F2216079B890CD57
4 changed files with 8 additions and 8 deletions

View file

@ -163,7 +163,7 @@ fn resolve_exposed_imports(
.into_iter() .into_iter()
.filter_map(|(symbol, _)| { .filter_map(|(symbol, _)| {
exposes.get(&module_id)?.iter().find(|(symb, _)| { exposes.get(&module_id)?.iter().find(|(symb, _)| {
//TODO this seems to not be comparing proprely so we aren't getting any exposed imports //TODO this seems to not be comparing properly so we aren't getting any exposed imports
symb == &symbol symb == &symbol
}) })
}) })
@ -179,7 +179,7 @@ fn make_modules_info(
typechecked: &MutMap<ModuleId, CheckedModule>, typechecked: &MutMap<ModuleId, CheckedModule>,
) -> ModulesInfo { ) -> ModulesInfo {
//We wrap this in arc because later we will go through each module's imports and store the full list of symbols that each imported module exposes. //We wrap this in arc because later we will go through each module's imports and store the full list of symbols that each imported module exposes.
//eg: A imports B. B exposes [add, mutiply, divide] and A will store a reference to that list. //eg: A imports B. B exposes [add, multiply, divide] and A will store a reference to that list.
let exposed = exposes let exposed = exposes
.into_iter() .into_iter()
.map(|(id, symbols)| (id, Arc::new(symbols))) .map(|(id, symbols)| (id, Arc::new(symbols)))

View file

@ -336,7 +336,7 @@ pub(super) fn get_upper_case_completion_items(
label: mod_name.clone(), label: mod_name.clone(),
kind: Some(CompletionItemKind::MODULE), kind: Some(CompletionItemKind::MODULE),
documentation: Some(formatting::module_documentation( documentation: Some(formatting::module_documentation(
formatting::DescripitonType::Exposes, formatting::DescriptionsType::Exposes,
mod_id, mod_id,
interns, interns,
modules_info, modules_info,

View file

@ -23,7 +23,7 @@ fn module_exposed_list(
}) })
}) })
} }
pub(super) enum DescripitonType { pub(super) enum DescriptionsType {
Exposes, Exposes,
} }
fn md_doc(val: String) -> Documentation { fn md_doc(val: String) -> Documentation {
@ -35,7 +35,7 @@ fn md_doc(val: String) -> Documentation {
///Generates a nicely formatted block of text for the completionitem documentation field ///Generates a nicely formatted block of text for the completionitem documentation field
pub(super) fn module_documentation( pub(super) fn module_documentation(
description_type: DescripitonType, description_type: DescriptionsType,
module_id: &ModuleId, module_id: &ModuleId,
interns: &Interns, interns: &Interns,
modules_info: &ModulesInfo, modules_info: &ModulesInfo,
@ -43,6 +43,6 @@ pub(super) fn module_documentation(
let exposed = || module_exposed_list(module_id, interns, modules_info).unwrap_or_default(); let exposed = || module_exposed_list(module_id, interns, modules_info).unwrap_or_default();
match description_type { match description_type {
DescripitonType::Exposes => md_doc(format!("```roc\n{0}\n```", exposed())), DescriptionsType::Exposes => md_doc(format!("```roc\n{0}\n```", exposed())),
} }
} }

View file

@ -388,11 +388,11 @@ mod tests {
} }
///Runs a basic completion and returns the response ///Runs a basic completion and returns the response
async fn completion_test( async fn completion_test(
inital: &str, initial: &str,
addition: &str, addition: &str,
position: Position, position: Position,
) -> Option<std::vec::Vec<std::string::String>> { ) -> Option<std::vec::Vec<std::string::String>> {
let doc = DOC_LIT.to_string() + inital; let doc = DOC_LIT.to_string() + initial;
let (inner, url) = test_setup(doc.clone()).await; let (inner, url) = test_setup(doc.clone()).await;
let reg = &inner.registry; let reg = &inner.registry;