madskristensen / Tweakster

A Visual Studio extension
Apache License 2.0
241 stars 23 forks source link

Ctrl + W does not close tab #13

Closed AlexVPerl closed 4 years ago

AlexVPerl commented 4 years ago

Thank you for creating this extension. Ctrl + W does not close tab on VS 2019, it just selects current line, current paragraph, etc. Is there any additional settings required to make Ctrl + W work?

madskristensen commented 4 years ago

It would work fine, but it won't kick in until the extension is fully loaded and, due to the async extension loading nature of VS, could happen several 30 seconds after your solution has loaded.

jenscski commented 4 years ago

Same problem here, Ctrl + W does not close tab.

Looks like VS i waiting for next keystroke. (double Ctrl+W opens internal browser pointing at https://visualstudio.microsoft.com/)

image

AlexVPerl commented 4 years ago

I waited for my solution to fully load, even hours later Ctrl + W still just selects current line/paragraph/etc. I even went into VS settings for shortcuts and removed anything mapped to Ctrl + W but still nothing. Would love to have it working. BTW I do not see the same message as @jenscski for some reason.

madskristensen commented 4 years ago

I'm beginning to think that it varies by what workloads people have installed in their VS instance. I think I need a different way to hook into the keybinding system to do this

AlexVPerl commented 4 years ago

Yeah that's probably it.

I got it working by just remapping Window.CloseDocumentWindow shortcut: https://gist.github.com/jpoehls/2030795

Issue was that Ctrl + W was mapped to a whole bunch of other actions (3 others, VS does not check for conflicts it seems). I think in your extension you'd just have to check if other things are mapped to it and clear those shortcuts.

madskristensen commented 4 years ago

I've completely changed implementation, so it bypasses the VS keybinding system and binds directly to the MainWindow's keyboard events. Please try the latest CI build and verify if this now works for you.

jenscski commented 4 years ago

Looks like that fixed it, I installed version 1.0.74, and now it works on my setup.

Thanks

madskristensen commented 4 years ago

@AlexVPerl can you verify as well, please. Then the issue can be closed.

luebster commented 4 years ago

I already had Ctrl + W bound to File.Close command. When I pressed Ctrl + W, Visual Studio was closing two tabs! Took me a few minutes to figure out what was actually happening. Perhaps add a note to your documentation to verify this keystroke is not already bound. Or perhaps you can clear it when the extension installs and/or loads?

madskristensen commented 4 years ago

Closing this ticket since the double closing is captured by #22