-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Evaluate all code blocks below current block with same scope #35
Conversation
@@ -10,7 +10,7 @@ let renderErrorIndicator = (colStart, colEnd, content) => | |||
++ "\n" | |||
++ content; | |||
|
|||
let executeRessultToWidget = (result: list(Worker_Types.blockData)) => { | |||
let executeResultToWidget = (result: list(Worker_Types.blockData)) => { |
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.
I blame @-jaredly for this. His reason-language-server is so good that I just tab tab tab
2203c03
to
e0033cd
Compare
|
||
let executeMany: | ||
Belt.Map.String.t(string) => Belt.Map.String.t(list(blockData)) = | ||
codeMap => { |
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.
This should be an explicit uncurried function. Bucklescript and ES6 proxy doesn't play nice with each others.
(. codeMap) =>
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.
I left some comments. I hope you can fix it as we are running the code in a browser. Toplevel is already a resources hugger
client/src_editor/Editor_Blocks.re
Outdated
) | ||
} | ||
}; | ||
| Block_Execute(_blockId) => |
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.
If we are not using it then we better remove _blockId
completely
client/src_editor/Editor_Blocks.re
Outdated
| Block_Execute(_blockId) => | ||
let allCodeBlocks = | ||
Belt.Map.String.fromArray( | ||
state.blocks |
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.
This is really inefficient (3n). We can do this in a single loop like this:
module MS = Belt.Map.String;
state.blocks
|. Belt.Array.reduceU(MS.empty, (. map, {b_id, b_data}) => {
switch (b_data) {
| B_Text(_) => map
| B_Code({bc_value}) => map |. MS.set(b_id, bc_value)
}
}))
As always, I didn't test this code :D
e0033cd
to
bff517a
Compare
| B_Text(_) => map | ||
| B_Code({bc_value}) => map |. MS.set(b_id, bc_value) | ||
} | ||
); |
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.
Whaaaaaaat. This really works huh?
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.
It actually does! 💯
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.
Perfect !
Additionally I think clearing up widgets in lower blocks should be cleared when the current field is updated.