-
-
Notifications
You must be signed in to change notification settings - Fork 89
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: core.send_code_block #391
feat: core.send_code_block #391
Conversation
This is a cool feature. I had an issue with
with the following
and it seemed to work. What do you think? |
I have to have an look onto that later on. For me the cursor moves to the next Did you test it with multiple code blocks, from start to end? |
Had a short glance on what I did there. So the part after If there should be an actual bug, I rather would fix the identification of the marks than to put big logic in this move part. |
I saw that there are some recent commits. Do you mind to test my branch Or the specific feature branch: |
I noticed something else that does not seem intended. With the following: # %%
def foo(x):
return x
foo(1)
# %%
print("hello")
# %%
def baz(x):
return x
baz(2)
# %% You can see that |
Okay, I think we simply have a differenf jnderstanding of the intended behaviour. In context of this functionality a code block are all lines between two block_deviders and on edge cases the start and end of the buffer. This matches the behaviour of editors like Pycharm, Jupyternotebooks etc. So you should not think about language spevific code blocks but custom defined seperation of your file. Since this is exactly how it works in many different places I strongly oppose to redesign this to something else. |
Gotcha, ive never used this feature before in other editors. I just downloaded vscode and I see what you mean now. Ill check your other branch now, |
combined_additions seems behind still, |
I think I would need to make separate Pull requests. I assume one feature I merged there is in cobflict with the recent merge, as it sets the repl file type to the language file type. See my comment in the other ticket. |
So I updated the feature_branch feature_send_code_block and updated the Pull Request. |
I am happy I could contribute and improve the plugin. Really nice that the work here continues! |
Thanks for the addition! I will try to stay more on top of the PRs |
@nickeisenberg that would be nice. Looking forward to the discussion about the other additions. One already has some discussion, but with one of the recent PR setting buffer type to iron there is even more discussion needed. The other is a straight forward fix. |
I can take a look at that file type issue discussion, if you have a strong opinion on it, we can always change it. |
Editors like vscode or pycharm or tools like jupyter notebooks let you send code blocks devided by a delimiter, eg. in python '#%%' or '# %%' to the repl.
The plugin jupytext is also to mention here, as it creates a .py representation of jupyter notebooks, in which in case of the py:percent style, the code blocks are delimited with '# %%'.
I wrote this feature which lets you define multiple code_deviders in the repl_definition and let you send the lines between those to the repl. Optionally one can choose to move the cursor to the next block in order to iterate easily through the file.
I also updated the doc and the readme to reflect for the changes and included two commands to the core.named_maps.
I hope you like, what I did here, and see the comfortable workflow provided by it.
I asked here #386 (comment), whether this would be possible, but then had fun, implementing it myself.