Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
After yesterday meeting with Tufts, we've realized the PyEditor has no way to process code same way the PyTerminal does.
This MR would like to expose the same API we have with the terminal, when the
script
with the typepy-editor
ormpy-editor
actually gets attached aprocess
field, among atarget
one when is notsetup
, where suchprocess(code)
will return a promise that resolves (or rejects) after the providedcode
has been evaluated.Please note the evaluation won't automatically print results in the editor output as I think that might be undesired (but we could change that if needed / requested).
/cc @ntoll @JeffersGlass
Changes
script
that can pass along the code to evaluate to the interpreterwindow
(global) whenever apy-editor
or anmpy-editor
has been bootstrappedDocumentation / Example
Once the
mpy-editor
event is triggered, if thescript
was asetup
one, it will process code after the setup is complete. In every other case, it will process code either before the code in the editor has run at least once, or after such code run already, it's up to the user.Checklist
CHANGELOG.md