Skip to content
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

Using vscode with Jupyter extension, how to find/replace text within a notebook cell #141493

Closed
lgonzalezsa opened this issue Jan 25, 2022 · 15 comments
Assignees
Labels
feature-request Request for new features or functionality notebook-find
Milestone

Comments

@lgonzalezsa
Copy link

In Jupyter Lab and Notebook web UI, it is possible to find and replace in the selected cell or entire notebook.

How to instruct vscode to replace only in the selected cell?

https://stackoverflow.com/questions/70043037/using-vscode-with-jupyter-extension-how-to-find-replace-text-within-a-notebook

@ghost ghost assigned rchiodo Jan 25, 2022
@rchiodo
Copy link
Contributor

rchiodo commented Jan 25, 2022

Thanks for the suggestion. Find/Replace is handled by VS code core. Transferring.

@ghost ghost unassigned rchiodo Jan 25, 2022
@rchiodo rchiodo transferred this issue from microsoft/vscode-jupyter Jan 25, 2022
@rebornix
Copy link
Member

rebornix commented Jan 25, 2022

@lgonzalezsa thanks for your feedback, this can be a great addition to the new filter UX we introduced for the find widget

image

@rebornix rebornix added feature-request Request for new features or functionality notebook-find labels Jan 25, 2022
@rebornix rebornix added this to the On Deck milestone Jan 25, 2022
@lgonzalezsa
Copy link
Author

Awesome!

@392781
Copy link

392781 commented Feb 4, 2022

@rebornix Why not just make it so that you search within the current selection?

If you're focusing a cell, you search the cell.
If you're focusing the notebook, you search the notebook.

It seems unnecessary to make this a toggle.

@sterafix
Copy link

Any update on this? I think find/replace is still a nightmare in Jupyter notebooks.

@rouzki
Copy link

rouzki commented Jun 6, 2022

Hi any update ?

@wandli
Copy link

wandli commented Jul 1, 2022

Wanting update +1

@jiawen1998
Copy link

jiawen1998 commented Jul 5, 2022

Any solutions to find/replace within the selected notebook cell?

@Greco1899
Copy link

+1. This would be really helpful!

@Chipmunk91
Copy link

This is going to be huge help!

@rouzki
Copy link

rouzki commented Jul 22, 2022

The solution that I am using :

  1. Select one occurrence of the text that you want to change.
  2. Press Ctrl+Shift+L, to select all occurrences of current selection.
  3. Then start editing all selection occurrences at the same time.

@luchungi
Copy link

The solution that I am using :

  1. Select one occurrence of the text that you want to change.
  2. Press Ctrl+Shift+L, to select all occurrences of current selection.
  3. Then start editing all selection occurrences at the same time.

The other way is to use Alt+Click of the mouse on all areas you want to edit at the same time if Ctrl+Shift+L ends up selecting beyond parts which you wish to edit.

For the VS Code solution to this problem, I think we need the find/replace function to have the option of restricting it to the selected text instead of just confining it to the selected cell as the prior option can also easily achieve the selected cell option. Of course, having both options is even better.

@rouzki
Copy link

rouzki commented Jul 22, 2022

The solution that I am using :

  1. Select one occurrence of the text that you want to change.
  2. Press Ctrl+Shift+L, to select all occurrences of current selection.
  3. Then start editing all selection occurrences at the same time.

The other way is to use Alt+Click of the mouse on all areas you want to edit at the same time if Ctrl+Shift+L ends up selecting beyond parts which you wish to edit.

For the VS Code solution to this problem, I think we need the find/replace function to have the option of restricting it to the selected text instead of just confining it to the selected cell as the prior option can also easily achieve the selected cell option. Of course, having both options is even better.

If I want to restrict my selection I don't use the mouse (as it's not easy, and takes too much time), I simply select the occurrence then keep pressing Ctrl+D to select only the next occurrence.

@lgonzalezsa
Copy link
Author

I learned from https://stackoverflow.com/a/73109147/1729896 that using F3 enables the find and replace for the cell, just what I need, hope this helps others.
CTRL-D also is a nice feature. Closing for now.

@gjsjohnmurray
Copy link
Contributor

See also #121218

@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality notebook-find
Projects
None yet
Development

No branches or pull requests

14 participants