Keyboard shortcut for formatting SQL

sqlninjasqlninja Posts: 22
edited October 29, 2011 4:22PM in SQL Prompt Previous Versions
After installing the latest build (5.1.92.8) I can no longer format the SQL using Ctrl + k, y. I have to go to the SQL Prompt 5 menu and select "Format SQL" I am using Microsoft SQL Server Management Studio 10.50.1600.1

Comments

  • Eddie DEddie D Posts: 1,803 Rose Gold 5
    Thank you for your post into the forum.

    Can you please reply with the actions you have taken where the Format SQL feature is not working for you. Unfortunately I am unable to replicate your issue.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • I am not sure what else there is to explain...
    After upgrading to the latest build, the keyboard shortcut (CTRL + k,y) for formatting text is gone.
  • There have been some changes related to key bindings, mostly to improve compatibility with Denali and Visual Studio.

    The biggest change is that the key bindings now only apply in the SQL editor scope - i.e. they will only be available when a SQL Query editor tab has the focus. However, I wouldn't expect this to cause any problems, because the commands that the bindings apply to already only work when a SQL query tab is active.

    A couple of questions:
    1. Is it only the 'Format SQL' command that is affected, or have all the menu commands lost their key bindings?
    2. Is there anything interesting in Prompt's logs (from the menu, select SQL Prompt 5 -> Help -> Show Log)? In particular, do any of the log entries mention 'bindings'?
    Development Lead
    Redgate Software
  • 1. Appears to be the only one...
    2. Nope.
  • Mike UMike U Posts: 316 Gold 1
    edited October 21, 2011 11:22AM
    Thanks for checking that for me!

    I'm afraid I've got another question, but to make up for it, a possible workaround too.

    Question: What version of SSMS are you using? [edit - apologies, I've just noticed that you told me the SSMS version in your first post :oops: ]
    Potential workaround: There's a hidden keyboard shortcut for Format SQL, "Ctrl+B, Ctrl+L" which was added for backwards compatibility with previous versions of Prompt. You could try that shortcut and see if it works for you.
    Development Lead
    Redgate Software
  • I have the same issue when using SSMS 10.50.2500.0. "Ctrl+B, Ctrl-L" doesn't work either. The shortcuts are not even listed on the menu any longer. Very inconvenient to have to use the menu option.
  • Thanks for reporting that. I'll investigate further using SSMS 2008R2
    Development Lead
    Redgate Software
  • I have the same problem with SSMS 2008R2.

    Thank's for verifying what's happening.

    Gervais.
  • I'm afraid I've been unable to reproduce this problem using SSMS 2008 R2, trying with both Windows 7 32 bit and Windows 7 64 bit.

    I've tried using a clean install of SQL Prompt 5.1.94.2, and also upgrades from 5.1.8.2 to 5.1.94.2, and directly from 5.1.6.35 to 5.1.94.2, and in all cases all the key bindings show up as expected.

    The steps I'm carrying out are as follows:
    • Launch SSMS 2008 R2
    • Connect to a database
    • Click on the SQL Prompt 5 menu (without a query window open) and check that the keyboard shortcuts are NOT available
    • Press 'New Query' on the toolbar to open a query window
    • Click on the SQL Prompt 5 menu to check that all keyboard shortcuts are now displayed
    • Cancel the menu, then type a simple query in the editor window (e.g. SELECT * FROM...)
    • Press CTRL+K,Y to format. Also tried using Ctrl+B,L

    Can you think of anything that might be special in your cases that I haven't considered?
    Development Lead
    Redgate Software
  • I've having the same issue. Neither CTRL-K, Y or B, L works.
    Running Win 7 64, Sql Management Studio 2008 R2 (10.50.2500.0), and Sql Prompt 5.1.94.2.

    Very annoying.
    We've gone on holiday by mistake. Are you the farmer?
  • I've also retried with Prompt version 5.1.92.8 as mentioned in previous posts, and still can't reproduce the problem.

    Do any of you have any other addins installed in SSMS?

    There's one thing that might help. Make sure SSMS is closed, then from a command prompt, run the following command:
    "%ProgramFiles(x86)%\Microsoft SQL Server\100\Tools\binn\VSShell\Common7\IDE\Ssms.exe" /setup
    

    Then restart SSMS.

    If the problem still persists, it would be really helpful if one of you could post the contents of the SQL Prompt log straight after SSMS starts (from the SQL Prompt 5 menu, select Help->Show Log).
    Development Lead
    Redgate Software
  • Hi,

    I had Sql Prompt installed and licenced, I removed other tools that I already installed from Sql Server Belt that I do not used. At this point, I began to be not able to use the format SQL shortcut.

    I remove all of Red Gate soft of my PC and re-install all the soft of Sql Server Belt, even those that I do not use.

    SQL Promt sql format shortcuts works fine now!

    Maybe it's something with installation-remove procedure.

    Thank's.
  • running
    "%ProgramFiles(x86)%\Microsoft SQL Server\100\Tools\binn\VSShell\Common7\IDE\Ssms.exe" /setup
    
    as suggested by Mike, solved this for me.

    Thanks
    We've gone on holiday by mistake. Are you the farmer?
  • I have updated to latest build but still have the problem.
    I am out of the office today so I will try the cmd tomorrow to see if that helps. I do have other add-ins installed such as SSMS Tools.
  • Hi,

    I ran the command above and it fixed the problem for me also. The short cut was missing from the menu and the CTRL B, CTRL L combo didnt' work either. now everything is fine.

    I'm using Win XP 32 bit so I ran the command as below:
    "%ProgramFiles%\Microsoft SQL Server\100\Tools\binn\VSShell\Common7\IDE\Ssms.exe" /setup
    


    Im using SSMS version 10.50.1600.1

    SQL prompt version: 5.1.94.2
  • I'm glad that I've found a solution for you, but I'm still trying to get to the bottom of why this happens to some people. It would be really helpful if anybody who's had this problem could post the following information to this thread:
    • Version number of SQL Prompt that is exhibiting the missing shortcut problem
    • Version of Prompt that was previously installed before upgrading to the problematic version
    • Whether any commands other than Format SQL have been affected
    • Version of SSMS in use
    • Which other addins are installed in SSMS
    • Operating system version and platform (e.g. Windows 7 64 bit)
    Thanks for helping!
    Development Lead
    Redgate Software
    • Version number of SQL Prompt that is exhibiting the missing shortcut problem: 5.1.94.2
    • Version of Prompt that was previously installed before upgrading to the problematic version: Whatever the prior release version was (looks like 5.1.8.2)
    • Whether any commands other than Format SQL have been affected: This appears to be the only one. Other shortcuts show in the menu.
    • Version of SSMS in use: 10.50.2500.0
    • Which other addins are installed in SSMS: Only the Red-Gate toolkit
    • Operating system version and platform: Windows 7 64 bit

    As a note, the command line fix didn't work for me. Still trying to find a solution.
    [Edit: My bad. Forgot to run cmd as Administrator. It worked when I did that.]
  • I've just found I too have this issue...

    Version number of SQL Prompt that is exhibiting the missing shortcut problem: 5.1.94.2

    Version of Prompt that was previously installed before upgrading to the problematic version: unknown, but would have been the last distributed version

    Whether any commands other than Format SQL have been affected: No, just this.

    Version of SSMS in use: 10.50.2500.0

    Which other addins are installed in SSMS: None

    Operating system version and platform: Windows 7 (32 bit)
  • Now I'm build 5.2.0.4 and SQL Prompt has stopped working altogether...
  • Hi sqlninja,

    I'm very sorry to hear that. Could you give me a bit more detail about what's happening?

    Mike
    Development Lead
    Redgate Software
  • After installing build 5.2.0.4 all options in the menu are greyed out except:
    Turn Off Prompting
    Find invalid Objects
    Options
    Snippet Manager
    Serial number
    Provide Feedback
    Help

    And when type inside of SSMS, SQL Prompt is not "prompting", although I would like to note that the keyboard shortcut for formatting (ctrl + k,y) is showing in the menu again albeit greyed out.
  • That's very strange. It implies that SQL Prompt hasn't managed to attach to the query window you're working with.

    Is there anything in the SQL Prompt log? (SQL Prompt 5->Help->Show Log)
    Development Lead
    Redgate Software
  • Here is all that was in the log:

    27 Oct 2011 16:45:00,092 [1] INFO RedGate.SqlPrompt.Engine.LogService - Starting new SQL Prompt editor session

    But opening another tab "enabled" it, the tab I was on was reopened by tab magic, after closing SSMS to install the update.

    Also, it now appears that formatting via the keyboard shortcut (ctrl + k,y) is working again...

    Thanks

    John
  • Thanks for log file - we've just come to the same conclusion regarding tabs opened with TabMagic ourselves. I would imagine this would also affect SQL documents opened directly from windows explorer into a fresh instance of SSMS.

    Working on a fix!
    James Allison

    Software Engineer - SQL Prompt
    Red Gate Software Ltd.
  • meklemblmeklembl Posts: 107 Bronze 2
    I too am having this problem. It started after I installed TabMagic, so I uninstalled it, but the problem continued.

    Here is the information of the software I am using
    Microsoft SQL Server Management Studio 10.0.2531.0
    Operating System 6.0.6002
    SQL Prompt 5.1.94.2
    Larry M
    Cleveland, OH USA
  • If you upgrade to SQL Prompt 5.2.0.5, you should find that both of these problems (missing keyboard shortcuts and incompatibility with Tab Magic) have both been resolved.

    You can upgrade using SQL Prompt's 'Check For Updates' feature.
    Development Lead
    Redgate Software
  • meklemblmeklembl Posts: 107 Bronze 2
    Thanks. The upgrade to 5.2.05 fixed the issue.
    Larry M
    Cleveland, OH USA
Sign In or Register to comment.