-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: Outdent code when running selection from a notebook #1391
feat: Outdent code when running selection from a notebook #1391
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1391 +/- ##
==========================================
+ Coverage 45.58% 45.63% +0.04%
==========================================
Files 506 506
Lines 34966 34984 +18
Branches 8734 8740 +6
==========================================
+ Hits 15940 15964 +24
+ Misses 18975 18969 -6
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out 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.
def my_func():
# run from here
a = 2
b = 3
def nested(x,y):
return (a + b)
c = nested(a, b)
print(c)
# to here
return c
Failure case
@dsmmcken Good catch. The newline is what wasn't accounted for (indent size is 0). Maybe I should pull this out into a util and write a few unit tests |
Fixes #1326
To test, put code in a notebook and run a selection where every line is indented. For example, run the function body of this code
Could be made into a util if we want to use it elsewhere. I looked in the monaco documentation to see if it had anything built-in for this and couldn't find any methods for it