Keyboard shortcut to reformat code quit working

amSteveamSteve Posts: 5 New member
edited August 28, 2015 9:40AM in SQL Prompt
My key chord of 'Ctrl + K + Y' has become unassigned. Not exactly sure when but recently. Might have coincided with install of SQL's ctp 2 but i didn't (intentionally) change anything re: my original install of mssms (Microsoft SQL Server Management Studio 12.0.2000.8). And i haven't yet installed sql prompt beta.

not seeing a keyboard assignment in options.

Comments

  • Aaron LAaron L Posts: 596 New member
    Hi Steve,

    Is it just the Format SQL shortcut that has stopped working or have all the keyboard commands stopped? If you right click on a query window are any shortcuts listed?
    dZlOt6u.png

    Thanks,
    Aaron.
  • I noticed the same problem. Yes, it coincided with the install of SSMS 2016 CTP 2. All my SQL Prompt key shortcuts are gone. Is there an easy way to restore them?
  • Aaron LAaron L Posts: 596 New member
    Hi Kevin,

    SQL Prompt should set the keyboard shortcuts on startup if they aren't correct - Installing a new SSMS might have caused a few things to get reset but Prompt should re-bind the keyboard shortcuts.

    Could you try enabling verbose logging (Prompt->Help->Enable Verbose Logging) then restart SSMS and have a look at the log (Prompt->Help->Show Log) if you search for FormatSQL you should see some lines that look like:
    28 Aug 2015 08:04:36,841 [1] DEBUG RedGate.SQLPrompt.CommonVS.Commands.VSCommandController - GetOrCreateDteCommand - CreateIfNotPresent command LicensedFeature(DefaultCommandImpl(name: FormatSQL), status=>Visible)
    28 Aug 2015 08:04:36,842 [1] DEBUG RedGate.SQLPrompt.CommonVS.Commands.VSCommandController - DTE command already exists for LicensedFeature(DefaultCommandImpl(name: FormatSQL), status=>Visible) with bindings (SQL Query Editor::Ctrl+K, Ctrl+Y|SQL Query Editor::Ctrl+B, Ctrl+L)
    
    I'm wondering what yours look like?

    Thanks,
    Aaron.
  • Restarting SSMS 2012 rebound the keys to their defaults. Which is good...

    However, I prefer FormatSQL bound to Ctrl-KD, just like Visual Studio. I also remove the Ctrl-BL and Ctrl-KY bindings to teach my muscle memory to always use Ctrl-KD.

    Unfortunately, SQL Prompt appears to wipe out this change, replacing my keys with its defaults.
  • Aaron LAaron L Posts: 596 New member
    Hi Kevin,

    It's possible to change what these defaults are if you're happy to edit an xml file as described here. (but with editing the same xml file in the Prompt 7 local app data and using SQL::Ctrl+K,Ctrl+D)

    Hopefully the next version of SSMS will support extensions (currently only addins are loaded) which has a more reliable command system that'll allow you to rebind them using the standard options in SSMS.

    Let me know if you have any difficulty with rebinding the shortcuts.

    Thanks,
    Aaron.
  • That worked. Thanks for your help.
Sign In or Register to comment.