mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
stop builtin crash
This commit is contained in:
parent
3027fc2284
commit
ae27682de7
3 changed files with 22 additions and 12 deletions
|
@ -105,7 +105,7 @@ pub(crate) fn global_analysis(doc_info: DocInfo) -> Vec<AnalyzedDocument> {
|
|||
abilities_store,
|
||||
docs_by_module,
|
||||
imported_modules,
|
||||
mut exposed_imports,
|
||||
exposed_imports,
|
||||
mut imports,
|
||||
exposed_types_storage,
|
||||
mut exposes,
|
||||
|
@ -116,6 +116,7 @@ pub(crate) fn global_analysis(doc_info: DocInfo) -> Vec<AnalyzedDocument> {
|
|||
subs: solved.into_inner(),
|
||||
abilities_store,
|
||||
});
|
||||
debug!("exposed_imports: {:#?}", &exposed_imports);
|
||||
let exposed_imports: HashMap<_, _> = exposed_imports
|
||||
.into_iter()
|
||||
.map(|(id, symbols)| {
|
||||
|
@ -124,7 +125,10 @@ pub(crate) fn global_analysis(doc_info: DocInfo) -> Vec<AnalyzedDocument> {
|
|||
symbols
|
||||
.into_iter()
|
||||
.filter_map(|(symbol, _)| {
|
||||
exposes.get(&id)?.iter().find(|(symb, _)| symb == &symbol)
|
||||
exposes.get(&id)?.iter().find(|(symb, _)| {
|
||||
//TODO this seems to not be comparing proprely so we aren't getting any exposed imports
|
||||
symb == &symbol
|
||||
})
|
||||
})
|
||||
.cloned()
|
||||
.collect::<Vec<_>>(),
|
||||
|
|
|
@ -241,6 +241,7 @@ impl AnalyzedDocument {
|
|||
.map(|a| a.chars().nth(0).unwrap().is_uppercase())
|
||||
.unwrap_or(false);
|
||||
if is_module_completion {
|
||||
//TODO: this doesn't work with builtins for some reason
|
||||
Some(get_upper_case_completion_items(
|
||||
position,
|
||||
symbol_prefix,
|
||||
|
@ -283,6 +284,7 @@ impl AnalyzedDocument {
|
|||
&mut subs.clone(),
|
||||
module_id,
|
||||
interns,
|
||||
exposed_imports,
|
||||
);
|
||||
Some(completions)
|
||||
}
|
||||
|
|
|
@ -308,8 +308,11 @@ pub fn get_completion_items(
|
|||
subs: &mut Subs,
|
||||
module_id: &ModuleId,
|
||||
interns: &Interns,
|
||||
exposed_imports: &Vec<(Symbol, Variable)>,
|
||||
) -> Vec<CompletionItem> {
|
||||
let completions = get_completions(position, decls, prefix, interns);
|
||||
let mut completions = get_completions(position, decls, prefix, interns);
|
||||
completions.extend(exposed_imports);
|
||||
debug!("extended with:{:#?}", exposed_imports);
|
||||
make_completion_items(
|
||||
subs,
|
||||
module_id,
|
||||
|
@ -340,15 +343,16 @@ pub fn get_upper_case_completion_items(
|
|||
format!("`{0}` module", mod_name),
|
||||
)]
|
||||
} else if prefix.starts_with(&mod_name) {
|
||||
make_completion_items(
|
||||
subs,
|
||||
module_id,
|
||||
interns,
|
||||
vars.clone()
|
||||
.iter()
|
||||
.map(|(sym, vars)| (sym.as_str(interns).to_string(), vars.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
vars.clone()
|
||||
.iter()
|
||||
.map(|(sym, vars)| {
|
||||
CompletionItem::new_simple(
|
||||
sym.as_str(interns).to_string(),
|
||||
//TODO! I need to get subs from the module we are completing from
|
||||
"builtin".to_string(),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
vec![]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue