sourcery-ai / sourcery-vscode

VS Code extension for Sourcery
MIT License
83 stars 11 forks source link

fix: Change the Linux `Ask Sourcery` shortcut to `ctrl+shift+y` #224

Closed brendanator closed 12 months ago

brendanator commented 12 months ago

Fixes: https://github.com/sourcery-ai/sourcery-vscode/issues/204

blakeNaccarato commented 12 months ago

The keybinding example suggests setting the key variable in any given keybind to define the default behavior, then to override on a per-platform basis. So maybe you could retain the desired behavior of having Ctrl+Y trigger Ask on Linux while still shunting Windows to Ctrl+Shift+Y by properly setting key to one option, along with the platform overrides?

See your implementation (prior to PR) versus one from the example extension featuring a platform override. Perhaps the Developer: Toggle Keyboard Shortcuts Troubleshooting and some tinkering on a Windows machine would reveal the issue.

I see that the results of running "Preferences: Open Default Keyboard Shortcuts (JSON)" on my machine shows Ctrl+Y for sourcery.chat.ask, so I think the missing default "key" (perhaps that should be set to the safer Ctrl+Shift+Y) in your package.json is the culprit?

The extension developer documentation is pretty sparse in this regard, so I can understand how this went awry. It could be that the Linux keybind is considered the default in absence of key specification, causing some fringe machine configurations getting hit.

brendanator commented 12 months ago

Thanks for the great explanation @blakeNaccarato!

I don't actually have access to a windows machine so have been working in the dark. I've taken your advice and set key to ctrl+shift+y and removed linux just to be sure. Hopefully this will work as expected 🤞

blakeNaccarato commented 12 months ago

Yeah the platform differences have bitten me as well before. Reach out if you need feedback on Windows-related issues going forward.

If Windows testing becomes important in the future, as long as you can write a test for the behavior, you could run tests in CI in a job matrix with this VSCode extension testing Action to get some Windows signal in your workflow. A bit of a hassle for just a keyboard shortcut nag, but it could help if the extension feature set grows a lot.