microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.78k stars 29.48k forks source link

Notebook `Add Find Match to Selection` not set up for cmd palette #233263

Open mullimanko opened 3 weeks ago

mullimanko commented 3 weeks ago

Environment data

Expected behaviour

In a jupyter notebook, executing "Add Selection to Next Find Match" in the command palette (multiple times) selects the next occurrence of a variable until the end of the notebook.

Actual behaviour

"Add Selection to Next Find Match" selects the next occurrence of a variable until the end of the code cell. There is also "Notebook: Add Find Match to Selection" in the command palette, but I don't know what this should do. Nothing happens when I execute it.

Yoyokrazy commented 2 weeks ago

Hi there! Couple questions about your setup:

I developed this feature with the assumption that this command would always be executed via a keystroke, and didn't intend for it to be used from the command palette, so there could be an issue with the selection context there. Is there a particular reason you chose to use the command palette to execute the command?

Additionally, a couple things are coming 🔜 with wrapping from bottom to top cells already landing on insiders, and selecting all matches is in review at the moment.

mullimanko commented 2 weeks ago

Thank you for your help. I think I wrote this part in my initial post wrong:

There is also "Notebook: Add Find Match to Selection" in the command palette, but I don't know what this should do. Nothing happens when I execute it.

When I execute "Notebook: Add Find Match to Selection" via keyboard shortcut it works as intended until the end of the notebook. Maybe I was confunsed because when I searched for "Notebook: Add Find Match to Selection" in the command palette, it didn't show this command. That said, when I trigger the other command "Add Selection to Next Find Match" via keyboard shortcut or via command palette, it only selects the next occurrence of a variable until the end of the code cell. Changing notebook.multiCursor.enabled to True or False had no effect to these two commands in my setup. I would endorse to be able to find "Notebook: Add Find Match to Selection" in the command pallete.

Yoyokrazy commented 2 weeks ago

Okay to summarize then:

Final questions:

I'm going to re-title this issue as a request just for working/better functionality of the command from within the command palette. This will end up being lower on the priority list, but will likely get covered in a debt cycle. Could you go into a bit more detail as to why you use these commands from the palette instead of the keystroke?

vs-code-engineering[bot] commented 2 weeks ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

mullimanko commented 1 week ago

Ok, first question: It seems that I had a typo in my settings.json, now the "Notebook: Add Find Match to Selection" only works when "notebook.multiCursor.enabled": true, as expected. Sorry for that. Second question: I don't use the "Notebook: Add Find Match to Selection" regularly from within the command palette. I just have Ctrl + D assigned to duplicate line, therefore I started to search the command I was looking for with some keywords like "select next occurrence" in the command palette because I didn't know the name.

This is the way I was taught to search for commands by "makers of VS code" in the course https://training.talkpython.fm/courses/visual-studio-code-for-python-developers. There is a own chapter on the command palette. According to the course description it is taught

by two experts who have both worked at Microsoft (makers of VS Code) [Brian Clark and Cecil Phillip]

In the course it is said something like: What I really appreciate about the command palette is that even if I’m not sure of the exact command or action I need, just by typing a few keywords, it filters the results and helps me discover what’s possible. For example, let’s say I want to adjust the settings for the command palette. To find those, I simply open the command palette with Ctrl+Shift+P and start typing "Settings." This shows me all the options related to that keyword, and I can quickly spot the one I need.