Bug #68707 Keyboard shortcut for comment/uncomment uses divideinstead of forward slash
Submitted: 18 Mar 2013 20:09 Modified: 10 Jun 2014 23:37
Reporter: Brad Lang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.47 OS:Windows
Assigned to: CPU Architecture:Any
Tags: comment, hotkey, workbench

[18 Mar 2013 20:09] Brad Lang
Description:
To comment/uncomment, workbench uses Ctrl + (divide key) instead of Ctrl + / (forward slash) as a keyboard shortcut.

How to repeat:
Select a block of SQL -> Ctrl + forward slash -> only deselects text and moves cursor before selection

Suggested fix:
Change key from divide to forward slash.

Other IDE's like Eclipse use forward slash both because it's within reach on the keyboard, and that many laptop keyboards don't have a divide key at all.
[4 Apr 2013 14:54] Armando Lopez Valencia
Thanks a lot for your report.
[10 Jun 2014 23:07] Nabil Bani
Here is the solution:
I have been trying to figure this out for quite sometime now. First off, comment/uncomment works with divide and not forward slash. Divide is the "forward slash" that exists in full size keyboard (i.e: you desktop keyboard has the extra number pad...) so use that forward slash. Use the same thing if you have a full size keyboard if you have one in your laptop.

Now, For those who does not have a full size keyboard on their laptop (like me). Instead hold Ctrl + Fn (function key) + 0. 
NOTE: You can trigger divide key if you use function + 0. If you have non-English keyboard then use button that has a divide key "Forward Slash".

I hope this helps.
[10 Jun 2014 23:37] Brad Lang
That's not a solution, that's a workaround.  Still needs to be changed to the forward slash next to shift because it's the one within finger reach.

Also should insert / remove -- at the beginning of the line instead of wherever the cursor happens to be.
[8 Jan 2015 18:17] Trent Moyer
This is still a problem in version 6.1.7.
The slash key next to the right shift key is not recognized.
The slash key over the numpad will work as expected.

When modifying main_menu.xml, Control+Slash and Control+Divide are both displayed as Control+Divide on the menus. Neither work with the slash key next to the right shift.
[26 Jul 2015 6:55] Paul Weiss
This still occurs in 6.3.4.0 on Microsoft Windows 7 Home Premium SP 1, 64-bit. The Ctrl+Fn+0 workaround does not work on my laptop (Dell Inspiron 7520). It would be great to have a keyboard shortcut for this!
[6 Jan 2016 16:22] Benjamin Rifkind
No slashes work for me. Not forward backward or the one over the the number pad. I'm using version 6.3.6 build 511 CE (64 bits) on Windows 7.
[3 Nov 2016 16:28] Tony F
This issue is a problem for me, please fix. All the other IDE's that I use for  work, works with the ctrl + /

6.3.8
[26 Apr 2017 19:50] None OfYourBusiness
Has this still not been fixed? Come on guys, what's up?
[13 Feb 2018 17:17] Katie O'Shea
Workbench shortcut set to "Divide"

Attachment: comment_shortcut_workbench.jpg (image/jpeg, text), 152.60 KiB.

[13 Feb 2018 17:18] Katie O'Shea
Documentation says should be set to " / ", but in program is not

Attachment: comment_shortcut_documentation.jpg (image/jpeg, text), 826.68 KiB.

[2 May 2018 14:36] Miguel Tadeu Mota
Posted by developer:
 
Not reproducible any more.
[26 Jun 2018 19:53] Mart Val
Mid 2018 and this doesn't seem to have been fixed... How is it not reproducible? 
The / key still doesn't work at all unless you use a numeric keypad. 

But those are starting to disappear from most keyboards, specially those on notebooks. None of my two current keyboards, the one on my Asus laptop and the external Thinkpad keyboard, have a numerical keypad, nor even one that you could select with the keyboard fn or numlock key. It's a trend that I appreciate for several reasons. 

Yet, how inconvenient finding out that the Ctrl+/ keyboard shortcut doesn't work in a state of the art, ultracomplete, piece of software as Workbench... It was the first shortcut that I tried to use, as it is the most used one... 

Can it be so hard for you guys to fix this? Please, please, please...
[26 Jun 2018 19:56] Tony F
agree, it is the most used and is still broken
[14 Sep 2018 0:44] Scott Hamilton
Fixing Comment / Uncomment feature

If the Menu item is inactive create and install this plugin. If the menu is working but the shortcut is not skip to step 6
1.	Create a file with the following code, Filename = comment_grt.py
from wb import *
import grt

ModuleInfo = DefineModule(name='Comment', author="Scott Hamilton", version='1.0')

@ModuleInfo.exportFilter("wb.text.comment", "Un/Comment Selection")
def commentText(text):
  lines = text.split("\n")
  if lines[0].startswith("-- "):
    return "\n".join((line[3:] if line.startswith("-- ") else line) for line in lines)
  else:
    return "\n".join("-- "+line for line in lines)

2.	Install the pluginvia menu  Scripting > Install Plugin/Module
3.	Select the .py file
4.	Press open
5.	Restart workbench
Now the Edit > Format Un/Comment Selection menu should be functional

6.	If the shortcut does not work, then edit the main_menu.xml ffile
            <value type="object" struct-name="app.MenuItem" id="com.mysql.wb.menu.edit.comment">
              <link type="object" key="owner" struct-name="app.MenuItem">com.mysql.wb.menu.edit.format_menu</link>
              <value type="string" key="caption">Un/Comment Selection</value>
              <value type="string" key="name">comment</value>
              <value type="string" key="command">plugin:wb.sqlide.comment</value>
              <value type="string" key="itemType">action</value>
              <value type="string" key="shortcut">Modifier+K</value>
            </value>
7.	Change the key after the Modifier+. The default is “Slash” and I changed it to K
8.	Restart Workbench again
Also it seems that Modifier+Slash is assigned twice so you could try changing or removing  the definition of the conflicting menu command
[16 Jun 2020 13:20] Terry Souza
Life is full of mistakes. There is nothing perfect in life by https://www.dissertationhqhelp.com/the-essays-com-review-5-10/ site. You have to face and meet with errors n every point in life. Bugs are part of life. You may face bugs at every point in your life. Hence, life without bugs and error is impossible.
[8 May 2021 10:00] A B
It is mid 2021 and this issue still exists. The steps described for executing the py file above are not clear. In any case, that would be a workaround at best.

A full solution is still missing. This is extremely frustrating as Comments are indeed the most frequently used query feature.