-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Feature/edit code #830
base: main
Are you sure you want to change the base?
Feature/edit code #830
Conversation
Nice, thanks @sbendary25 for working on this and of course @ericrallen for the incredible initial PR. If this can be adapted to the current codebase (I think this PR is from a few weeks ago) I'd be happy to merge. I'd probably simplify it tho — for example I think this shouldn't interface with any code scanning utils (any code the user has written = deemed safe by them, I think). Is the only reason for that crossover because we also use a tempfile to scan code? I'd probably want to reduce it to a magic command which edits the last code block, then continues OI from there. This way user's can:
|
I am excited for this one |
I think what we can do: if system_platform == 'windows':
subprocess.run(['start', 'your_editor', filename], shell=True) When the user is done we can give the option to re-edit the code or run it. |
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.
interpreter/core/respond.py
@@ -1,10 +1,8 @@ | |||
import argparse |
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.
except GeneratorExit: | ||
# The user might exit here. | ||
# We need to tell python what we (the generator) should do if they exit | ||
break | ||
|
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.
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.
interpreter/cli/cli.py__
import os | ||
import platform | ||
import pkg_resources | ||
import appdirs |
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.
sbendary25:feature/edit-code
import appdirs | |
import appdirs |
|
||
## break_outer_loop var is used to signal another break | ||
## once we exit the following while-loop | ||
break_outer_loop = False | ||
if "executing" in chunk: |
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.
sbendary25:feature/edit-code
Describe the changes you have made:
scan and edit recently edited code by creating a while loop around the "executing" chunk conditional block
Reference any relevant issue (Fixes #000)
this is based on the following PR by ericrallen
#612
I have tested the code on the following OS:
AI Language Model (if applicable)