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

Command Palette integration #64

Open
coffenbacher opened this issue Dec 28, 2022 · 2 comments
Open

Command Palette integration #64

coffenbacher opened this issue Dec 28, 2022 · 2 comments

Comments

@coffenbacher
Copy link

I've never used the Refactor menu in VSCode, so I was surprised to find out it doesn't seem to be integrated with the Command Palette (I can't find Refactor commands through it, like Surround With etc.).

The Command Palette is my preferred method of interaction with this type of command so I don't have to remember custom keyboard shortcuts (or god forbid, use a mouse 😄 ).

Is there a way to add some/all of these commands to the Command Palette? Or is there a design reason those aren't tied together?

Thanks! Love the power of the extension, just trying to figure out how to fit it in my workflow.

@lgrammel
Copy link
Contributor

Thanks for the suggestion!

Code actions (as shown in the code action menu) are context specific and are not available most of the time. Adding them to the command palette would add a lot of commands which won't be working most of the time.

I'm keeping this issue open, in case I find a way to filter/hide them when they are not available for the given cursor location.

@coffenbacher
Copy link
Author

Adding them to the command palette would add a lot of commands which won't be working most of the time.

Good point, I'm surprised that there's not a way to make them context-dependent, doesn't look like there is...

I wonder how big of an issue it is to have not-working commands available, however? I guess there are three reasons I can think of to avoid them, and then my thoughts on those...

  • avoid polluting global namespace
    • I just looked through my palette by hand and there are hundreds of commands there that I've never seen before 😅 And most of them are irrelevant to most contexts. (eg ESlint commands in a Ruby file, CSV highlighting commands in JS, etc...) So I don't think namespace pollution is a problem in practice, at least for me?
  • reduce discoverability of important P42 commands (eg licensing commands)
    • thought, maybe a different prefix for the refactor actions?
  • user frustration at broken commands
    • maybe make it a setting, and/or when an action is not available pop up a toast pointing users to the refactor menu to discover which actions are currently available?
    • most of the time I know the action I want to take, and it's essentially always been available when I go through to the refactor menu, so at least for my usage pattern it wouldn't be frustrating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants