-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breadcrumb bar #1118
base: dev
Are you sure you want to change the base?
Breadcrumb bar #1118
Conversation
…nconsistency for type members
src/haz3lweb/view/ScratchMode.re
Outdated
let l2 = | ||
List.concat(List.map(t1 => tag_term(snd(t1), level), t)); | ||
l1 @ l2; | ||
| _ => [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, another annoying little detail!! For pattern matching over expressions like this we like to write out every case, instead of having a catch-all "_ => ..." so that if anyone else adds anything to the language, the compiler will force them to update this function.
let tagged = tag_term(term, 1); | ||
let lst = combineList(tagged); | ||
let ancestors = Info.ancestors_of(ci); | ||
let rec filter_ancestors = (ancestors_lst: Info.ancestors, level: int) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, here's a couple tricks that might help:
- you can combine patterns when pattern matching
- you can add a "when" to pattern matches as well
so this whole thing could probably become just one pattern match with four cases
switch (Id.Map.find_opt(List.hd(ancestors_lst), info_map)) {
| Some(Info.InfoExp({Fun(_), ancestors, _})) when List.length(ancestors) >= 1 => [ ... ]
| ...
@xzxzlala I think we actually want to include let bindings of regular values, not just functions, in the list + we want to show siblings of the current position, even at the top level. we can have a special "dot" location for when you aren't on a binding. |
Sure, I will add the "dot" for cursor not in bindings. |
It will add more items to the dropdown but it shouldn't increase the horizontal width much since that is based on depth -- it isn't common to nest let bindings very deeply. |
I see, I misunderstand that. We want all other regular values to be siblings in same level and when in the body of new functions/modules we add another level. |
There would be a new level whenever one binding is nested in another, so also in
|
k i'm good to restyle if you want. when this is current with dev i'll branch off and do the restyling, then PR against this |
Seems to be quite buggy right now -- try moving around the following program:
It should indicate |
Breadcrumb bar of hazel.
Now merged the haz3l-module branch.
could show the current function/module you are in, and the droppings contains other same level functions/modules.
The level is decided by how many funs/modules you are in.
For example, below the cursor is in f1 and g3 and finally in M2: