microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 294 forks source link

Copy cell output command not working correctly #16149

Closed amunger closed 3 weeks ago

amunger commented 3 weeks ago

@amunger Thanks for your reply. you mean this? Image

it is not working, for me

Originally posted by @Shahin-rmz in #15948

amunger commented 3 weeks ago

@Shahin-rmz - yes, that command should work. Can you try without that when clause? You could try something like this for the when clause instead: notebookEditorFocused && !inputFocus

The interactive window history is a notebook, so that should work.

If it's still not working you can use toggle keyboard shortcuts troubleshooting to make sure that the command is actually being invoked.

Shahin-rmz commented 3 weeks ago

The interactive window history is a notebook, so that should work.

Thanks for the solution. It works like a charm. 🥇

Just a quick idea, it would be awesome if we could select and copy a chunk of output to be able to search it on the internet or whatever. Something like Vim Visual mode but in interactive window.

I am hardcore Vim user, and for my new work position I am using VS code and actually like it. But some small details (like what above said) is missing. Thanks, best

Shahin-rmz commented 3 weeks ago

Image here is an example of it. in this case I just selected the error text.

NameError: name 'pri' is not defined and each chunk between ## is code.

##
code
##

something like VS code

# %%
code

for interactive window.

I could select some parts of text because of Tmux text selection. Ipython itself did not have this feature. So maybe if I can open interactive window inside VScode Tmux, it may work.

The error that I have copied with your method is like this:

{
    "name": "NameError",
    "message": "name 'pr' is not defined",
    "stack": "---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
~/Computer/projects/test/test.py in <module>
      1 #%%
----> 2 pr

NameError: name 'pr' is not defined"
}

Thanks, best

amunger commented 3 weeks ago

thanks for the feedback - I agree the notebook output sections are not very keyboard friendly at this point.

One workaround would be to use the accessibility view when focused on the output (alt+f2), but I just realized that it's not yet enabled for the IW, https://github.com/microsoft/vscode/issues/232421. It should be soon though.